How to make a checkpoint system

How can I write a simple checkpoint script for my obby game? (one that saves so if the player leaves and comes back they’re where they left off)

Keep in mind I am not an advanced scripter by any means -

3 Likes

So first of all make a folder in the workspace called checkpoints and put all the checkpoints in there calling them checkpoint1, checkpoint2…you get the idea

In serverScriptService make a leaderstats script that makes a IntValue called “Stage”

Next add a script in ServerScriptService and call it CheckpointHandler

for i, checkpoint in pairs(game.Workspace.Checkpoints:GetChildren) do
    checkpoint.Touched:Connect(function(hit)
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        if plr then
            plr.leaderstats.Stage.Value = i
        end
    end
end

Then to make it save follow this YouTube video I made:

3 Likes