Answered Plainly
Display: Text size:

Build a Whole Mini-Game: Finish-Line Obby

The short answer: An obby is an obstacle course. This one is small but complete: a few platforms, a finish pad, and three scripts you already know from this series. Touching the finish pad awards 50 points — once, thanks to a cooldown, not fifty times — the points show on the leaderboard, and DataStore saves them so they are still there when a player comes back tomorrow. Every script is printed whole, with a Copy button.

Build the course

  1. Start from a Baseplate place (page 1). The flat baseplate is your ground, and the SpawnLocation is where players appear.
  2. Add a handful of parts floating above the baseplate to make a short jumping course: a start platform near the spawn, three or four platforms to hop across, and one final platform. Color the final platform something bright.
  3. Select each platform part and turn its Anchored property on. Remember from the client-server guide: every part joins the physics simulation unless it is told otherwise — an unanchored platform falls out of the sky the moment the game starts.
  4. On the final platform, add one more flat part to stand on as the finish pad, and name it FinishPad in the Explorer. Names matter: your script finds its part through script.Parent, and you find your scripts by the names you gave them.

Script 1 — the leaderboard

Exactly the script from page 6. Put a Script named Leaderboard in ServerScriptService:

-- Put this Script in ServerScriptService. Name it Leaderboard.
local Players = game:GetService("Players")

local function onPlayerJoin(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local points = Instance.new("IntValue")
	points.Name = "Points"
	points.Value = 0
	points.Parent = leaderstats
end

Players.PlayerAdded:Connect(onPlayerJoin)

Script 2 — the finish pad

This is page 5's cooldown plate with a prize attached. Put a Script inside the FinishPad part:

-- Put this Script inside the FinishPad part.
local part = script.Parent
local Players = game:GetService("Players")

local cooldowns = {}
local COOLDOWN_TIME = 5
local PRIZE_POINTS = 50

local function onFinishTouched(otherPart)
	local player = Players:GetPlayerFromCharacter(otherPart.Parent)
	if not player then
		return
	end

	local lastTouch = cooldowns[player] or 0
	if tick() - lastTouch < COOLDOWN_TIME then
		return
	end
	cooldowns[player] = tick()

	local leaderstats = player:WaitForChild("leaderstats")
	local points = leaderstats:WaitForChild("Points")
	points.Value += PRIZE_POINTS
	print(player.Name .. " finished and earned " .. PRIZE_POINTS .. " points!")
end

part.Touched:Connect(onFinishTouched)

Why the cooldown is 5 seconds here: it stops a player standing on the pad from farming it — one finish, one prize, then the pad rests. In a bigger obby you would also send the player back to the start to run it again; even without that, the cooldown keeps the score honest.

Script 3 — saving

Exactly the script from page 6. Put a Script named SavePoints in ServerScriptService:

-- Put this Script in ServerScriptService. Name it SavePoints.
-- It works together with the Leaderboard script.
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local pointsStore = DataStoreService:GetDataStore("PlayerPoints")

local function loadPoints(player)
	local leaderstats = player:WaitForChild("leaderstats")
	local points = leaderstats:WaitForChild("Points")

	local success, savedPoints = pcall(function()
		return pointsStore:GetAsync("Player_" .. player.UserId)
	end)

	if success and savedPoints ~= nil then
		points.Value = savedPoints
	end
end

local function savePoints(player)
	local leaderstats = player:FindFirstChild("leaderstats")
	if not leaderstats then
		return
	end
	local points = leaderstats:FindFirstChild("Points")

	local success, errorMessage = pcall(function()
		pointsStore:SetAsync("Player_" .. player.UserId, points.Value)
	end)

	if not success then
		warn(errorMessage)
	end
end

Players.PlayerAdded:Connect(loadPoints)
Players.PlayerRemoving:Connect(savePoints)

Playtest it

  1. Run the game. Your Points should read 0 on the scoreboard.
  2. Run the course and step on the FinishPad. Watch Output for ... finished and earned 50 points! and the scoreboard for 50.
  3. Stay standing on the pad for a few seconds. The score must not move — that is the cooldown working. Step off, wait out the 5 seconds, step on again: 100.
  4. To test saving in Studio, you need page 6's switch: in a test copy of the game, turn on Enable Studio Access to API Services (File > Experience Settings > Security). Finish once, stop the test, run it again — your saved points should load back. In the live game this works with no switch at all.

When it breaks: what to check, in order

Make it yours: change PRIZE_POINTS, lengthen the course, add a second pad worth more. Every number a player can earn lives in these server scripts — which is where page 7 says numbers belong. When you are ready to show friends, the last page of this series covers publishing and keeping the game — and your account — safe.

Sources (official only; read in full November 7, 2026):

All three scripts' logic was run on this machine against a small fake Roblox setup before this page was written: a test player finished the course for +50 points, an instant second touch was blocked by the cooldown, a later finish brought the total to 100, and the save/load round trip from page 6 was verified with the same rig. The scripts were also checked line by line against the documentation above. Checked November 7, 2026.