Menu
CoddyTech

Your First Obby

Part of the Roblox Game Scripting section of Coddy's Lua journey. Lesson 24 of 24.

An obby (obstacle course) is the classic first Roblox game: get from the start to the finish without touching anything deadly. This one floats in the sky:

  • Start: the spawn
  • LavaFloor: a wide gray platform. The two lava strips on it are in the Lava folder in workspace.
  • Checkpoint: a SpawnLocation halfway
  • Path: a narrow walkway
  • Finish: the gold platform

One script in ServerScriptService runs the whole game, using everything from this course. One detail is new:

With two SpawnLocations (the start and the checkpoint), LoadCharacterAsync respawns the winner on their RespawnLocation, so point it back at the start before sending them there.

challenge icon

Challenge

Hard

Make the whole obby work from one script:

  1. Every player gets leaderstats with an IntValue Wins at 0, and their RespawnLocation is workspace.Start.
  2. Every part in workspace.Lava defeats whoever touches it.
  3. Touching workspace.Checkpoint makes it the player's respawn point.
  4. Touching workspace.Finish adds exactly 1 to Wins, sets the player's RespawnLocation to workspace.Start and sends them there with LoadCharacterAsync(). Finishing again later adds another win.

Press Play and beat your obby, then Check. The test player runs it twice.

Try it yourself

local Players = game:GetService("Players")

-- 1. Every player gets leaderstats with Wins = 0, and starts at the start
Players.PlayerAdded:Connect(function(player)

end)

-- 2. Every part in workspace.Lava kills

-- 3. The checkpoint becomes the player's respawn point

-- 4. The finish: +1 win, then back to the start
quiz iconTest yourself

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

All lessons in Roblox Game Scripting

Practice on your own: Online Lua compiler