I’ve been working hard recently on developing a new obby. One of the most notable scripts I’ve been having trouble with is an obby checkpoint system.
In my “Workspace,” I have a folder called “Checkpoints” and every spawn point labelled with numbers (1,2,3,4, etc). To make this work, I have a script called “CheckpointScript” that’s responsible for changing the stage rankings on the leaderboard.
However, after a lot of testing, it’s become clear to me there’s an issue in this script — whenever I join the game, my stage level switches to “2” even though I’m actually beginning stage “1” I have my script below, and I hope someone can help me pinpoint exactly what’s causing the issue.
local Checkpoints = workspace.Checkpoints game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new("Folder", plr) leaderstats.Name = "leaderstats" local Checkpoint = Instance.new("IntValue", leaderstats) Checkpoint.Name = "Stage" Checkpoint.Value = 1 plr.CharacterAdded:Connect(function(char) wait() if Checkpoint.Value > 1 then char:MoveTo(Checkpoints:FindFirstChild(Checkpoint.Value - 1).Position) end end) end) for i, v in pairs(Checkpoints:GetChildren()) do v.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local char = hit.Parent local plr = game.Players:GetPlayerFromCharacter(char) local Checkpoint = plr.leaderstats.Stage if tonumber(v.Name) == Checkpoint.Value then Checkpoint.Value += 1 end end end) end