§ How to · with Picoo

How to make a Roblox checkpoint system (with AI)

By Sametcan Tasgiran, Founder & Developer·Published ·Updated

A Roblox checkpoint system needs four pieces: touch-activated checkpoints, RespawnLocation updates, progress UI, and persistent save state. Ask Picoo for one and it writes these for your map; the build below is an example for obbies, races and parkour maps. If you ask for a whole obby, Picoo's obby recipe builds numbered checkpoints into the course.

Example build: 4 files · 130 lines. RespawnLocation-based, no custom respawn script needed.

Touch-activated checkpoints

Any SpawnLocation tagged 'Checkpoint' with a CheckpointNumber attribute. Touching it sets your RespawnLocation, which only accepts SpawnLocations. Crossing the same checkpoint twice has no effect.

Progress HUD

Top-center counter showing 'Checkpoint X / TOTAL'. Updates instantly on checkpoint hit. Optional segment timer for speedrun mode.

Persistent save

Last checkpoint reached is saved to DataStore. Player who rejoins is teleported to their saved checkpoint, not the lobby.

Skip prevention

Checkpoints count only in order: touching Checkpoint 5 when you are on 2 does nothing until you have touched 3 and 4. Skipping ahead with a long jump or a teleport does not count.

Win sequence trigger

Touching the final checkpoint fires a server-side win event. Optional fireworks VFX, win UI, leaderboard write.

Per-stage timer

Optional mode that records time from previous checkpoint to current. Used by speedrun-style maps. Saved alongside checkpoint state.

Example output from a build like this

4 files in this example. Picoo writes this code for your prompt, so file names and sizes vary.

ServerScriptService/CheckpointManager.lua

Touch handler, RespawnLocation update, skip prevention

ServerScriptService/CheckpointSaveService.lua

DataStore per-player progress

ReplicatedStorage/Remotes/CheckpointHit

Server → client HUD update

StarterGui/CheckpointHUD.lua

Counter + optional segment timer

Sample output: ServerScriptService/CheckpointManager.lua

--!strict
-- ServerScriptService/CheckpointManager.lua  (Picoo · excerpt)
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CheckpointHit = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("CheckpointHit")
local SaveService = require(script.Parent.CheckpointSaveService)

type State = { current: number, segmentStart: number }
local progress: { [Player]: State } = {}

local function setup()
    for _, part in ipairs(CollectionService:GetTagged("Checkpoint")) do
        local n = part:GetAttribute("CheckpointNumber") :: number
        if not n then continue end
        part.Touched:Connect(function(hit)
            local player = Players:GetPlayerFromCharacter(hit.Parent)
            if not player then return end
            local p = progress[player] or { current = 0, segmentStart = os.clock() }

            -- Sequence enforcement
            if n ~= p.current + 1 then return end

            local segmentTime = os.clock() - p.segmentStart
            p.current = n
            p.segmentStart = os.clock()
            progress[player] = p

            player.RespawnLocation = part
            SaveService:Set(player, p.current)
            CheckpointHit:FireClient(player, n, segmentTime)
        end)
    end
end

setup()

Building a Roblox checkpoint system

Checkpoint systems are the difference between a frustrating obby and a fun one. The right pattern keeps players moving forward; the wrong pattern punishes them for not finishing in one session.

In this example the checkpoint system is four files. The core pattern uses Roblox's native RespawnLocation property: checkpoints are SpawnLocations, and touching one sets the player's RespawnLocation to it. Death respawns them there automatically, with no custom respawn script.

Skip prevention is the underrated feature. Touching Checkpoint 5 when your last was 2 is ignored until you touch 3 and 4. A teleport exploit can move the character but cannot jump the sequence. The check is one comparison (n == current + 1), so it stops the most common skip without a separate anti-exploit pass.

Persistent save flow is what turns the system from a session toy into a real game mechanic. Players who quit at Checkpoint 8 rejoin at Checkpoint 8. The save happens on every checkpoint hit, so a crash loses at most one segment of progress. DataStores are shared by every place in an experience, so give each map its own DataStore name if players should keep separate progress on each.

The segment timer is the speedrun layer. Each checkpoint records the time since the previous one, so speedrun maps can show per-segment splits and a total. Persistent best times can be written to a separate 'BestTimes' DataStore on the win checkpoint; ask for it in a follow-up prompt.

See more on the Luau generator, the AI Luau script writer, the 3D model generator and the game builder, read how Picoo compares with ChatGPT, or browse the full blog.

Frequently asked

Why use RespawnLocation instead of a custom respawn?+

RespawnLocation is the native Roblox property. Setting it to a SpawnLocation tells Roblox to respawn the player there on death, so there is no custom respawn code and no edge cases to handle. The fewer custom mechanics, the fewer bugs.

How does skip prevention work?+

Each checkpoint requires the previous one to have been touched. Touching Checkpoint 5 when your progress is 2 is ignored; the player must touch 3, then 4, then 5. A teleport past a checkpoint therefore does not count, without any separate anti-exploit code.

Can I have multiple parallel paths (left or right)?+

Yes. Give the left and right checkpoints of the same stage the same CheckpointNumber. The check only asks for your current number + 1, so either path counts.

What about a win counter on the win checkpoint?+

In this example the final checkpoint fires a server-side win event. To count wins, have it add 1 to a Wins value in leaderstats and save it with the rest of the player's data; ask for it in your prompt if your game has a leaderboard.

Does the segment timer survive disconnects?+

No — segment timers are for in-session speedrunning. The overall checkpoint progress is saved across sessions, but the segment-by-segment time tracking resets on rejoin. For persistent best times, write to a separate 'BestTimes' DataStore on win.

Related Picoo prompts