Start building

Roblox Obby Checkpoint Script (With Auto DataStore Save)

Handles numbered parts inside Workspace.Checkpoints (1, 2, 3...) and automatically saves each player's Stage across sessions.

Type: ScriptExplorer: ServerScriptServiceLevel: Intermediate
ScriptServerScriptService
-- Script in ServerScriptService
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")

local store = DataStoreService:GetDataStore("ObbyStages_v1")
local checkpoints = workspace:WaitForChild("Checkpoints")

local function moveToStage(char: Model, stageNum: number)
	local pad = checkpoints:FindFirstChild(tostring(stageNum)) :: BasePart?
	if pad then
		task.wait()
		char:PivotTo(pad.CFrame + Vector3.new(0, 4, 0))
	end
end

for _, pad in ipairs(checkpoints:GetChildren()) do
	if pad:IsA("BasePart") then
		local num = tonumber(pad.Name)
		if num then
			pad.Touched:Connect(function(hit)
				local p = Players:GetPlayerFromCharacter(hit.Parent)
				local stage = p and p:FindFirstChild("leaderstats") and p.leaderstats:FindFirstChild("Stage")
				if stage and num == stage.Value + 1 then
					stage.Value = num
				end
			end)
		end
	end
end

Players.PlayerAdded:Connect(function(player)
	local stats = Instance.new("Folder")
	stats.Name = "leaderstats"
	stats.Parent = player

	local stage = Instance.new("IntValue")
	stage.Name = "Stage"
	stage.Value = 1
	stage.Parent = stats

	local ok, saved = pcall(function() return store:GetAsync("s_" .. player.UserId) end)
	if ok and type(saved) == "number" then stage.Value = saved end

	player.CharacterAdded:Connect(function(char) moveToStage(char, stage.Value) end)
end)

Players.PlayerRemoving:Connect(function(player)
	local stage = player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Stage")
	if stage then pcall(function() store:SetAsync("s_" .. player.UserId, stage.Value) end) end
end)

How to install in Studio

  1. Create a Folder named Checkpoints inside Workspace and add Parts named 1, 2, 3, etc.
  2. Insert a Script named CheckpointSystem inside ServerScriptService and paste the code.
  3. Enable Studio Access to API Services in Game Settings > Security to test saving in Studio.

Tips & customization

  • Change `num == stage.Value + 1` to `num > stage.Value` if players are allowed to skip ahead.

Common questions.

Why does DataStore say API Services not enabled in Studio?

Open Game Settings > Security in Roblox Studio and toggle 'Enable Studio Access to API Services' ON.

More free Luau scripts.

All 16 scripts

Skip manual wiring.
Let Revix code & playtest it.

Start building free

Free to start. No card needed.