Menu
CoddyTech

Your First Obby

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

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. In PlayerAdded: leaderstats with an IntValue Wins at 0, and RespawnLocation set to workspace.Start.
  2. Every part in workspace.Lava defeats whoever touches it.
  3. Touching workspace.Checkpoint makes it the player's respawn point.
  4. workspace.Finish adds exactly 1 to Wins, sets RespawnLocation to workspace.Start and calls LoadCharacterAsync().

Press Play and beat the obby twice: Wins shows 2. Then Check.

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