Menu
CoddyTech

The Game Script

Lesson 1 of 18 in Coddy's Roblox Game: Disaster Survival course.

In this course you build one game, a lesson at a time: Disaster Survival. Players wait in a lobby, get teleported to an island, and try to outlast a flood, a meteor shower or a shrinking floor. Whoever is still standing when the time runs out wins.

A whole game like this runs from one Script in ServerScriptService. Yours is called RoundManager, and every lesson adds a feature to it.

The numbers a game designer tunes, such as how long a round lasts, live in a ModuleScript. This place has one in ReplicatedStorage named Settings. A ModuleScript returns one value, here a table, and require runs it and hands you that value:

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

With the settings in one module, one change tunes the whole game, and every script that needs them reads the same table.

challenge icon

Challenge

Easy

Your RoundManager Script is in ServerScriptService.

  1. Load the settings: local Settings = require(game.ReplicatedStorage.Settings).
  2. Print how long a round lasts, built from Settings.RoundLength. The Output should read Rounds last 15 seconds.
  3. When a player joins, give them a Folder named leaderstats holding an IntValue named Wins.

Press Play to see Wins on the leaderboard, then Check.

Try it yourself

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

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


-- 2. Print how long a round lasts, using Settings.RoundLength


-- 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: Disaster Survival