Menu
CoddyTech

The Tower Script

Lesson 1 of 18 in Coddy's Roblox Game: Endless Tower course.

In this course you build a tower obby: every round a new tower is stacked from random stages, lava rises from below, and the first to the top wins. By the end it has spinners, vanishing steps, conveyors, lasers, bounce pads, checkpoints and best times.

One Script in ServerScriptService, called Tower, runs the game. The numbers that balance it (how many stages, how fast the lava rises) live in a ModuleScript, ReplicatedStorage.Settings, and require hands you the table it returns:

local Settings = require(game.ReplicatedStorage.Settings)
print(Settings.StageCount) --> 5

Tuning an obby means changing those numbers again and again, so they live in one place.

challenge icon

Challenge

Easy

Your Tower Script is in ServerScriptService.

  1. Load the settings with require(game.ReplicatedStorage.Settings).
  2. Print how many stages a tower has, built from Settings.StageCount: the Output should read Each tower has 5 stages.
  3. When a player joins, give them a leaderstats Folder holding an IntValue named Wins.

Press Play, then Check.

Try it yourself

-- Tower: the Script that runs your whole game.
local Players = game:GetService("Players")

-- 1. Load the settings: require the ModuleScript
--    game.ReplicatedStorage.Settings


-- 2. Print how many stages a tower has, using Settings.StageCount


-- 3. Give every player a Wins value on the leaderboard
--    (a Folder named leaderstats holding an IntValue named Wins)
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Roblox Game: Endless Tower