Why not use the other one? Not saying you should, just curious why you wouldn’t. It is a much simpler way to go. Also thanks!
BTW: If the problem was that you couldn’t connect it, basically just replace
game.Players.PlayerAdded:connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats") or Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local checkpointStat = Instance.new("IntValue", leaderstats)
checkpointStat.Name = STAT_NAME
checkpointStat.Value = 1
player.CharacterAdded:connect(function(character)
local goto = checkpoints[checkpointStat.Value]
if goto then
repeat wait() until character.Parent
character:MoveTo(goto.Position)
else
warn("Checkpoint " .. checkpointStat.Value .. " not found")
end
end)
end)
with
game.Players.PlayerAdded:connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats") or Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local checkpointStat = leaderstats:FindFirstChild(STAT_NAME)
player.CharacterAdded:connect(function(character)
local goto = checkpoints[checkpointStat.Value]
if goto then
repeat wait() until character.Parent
character:MoveTo(goto.Position)
else
warn("Checkpoint " .. checkpointStat.Value .. " not found")
end
end)
end)
and change the STAT_NAME variable to the name of your leaderstats value. (Which is the same in your case)
Anyway, hope these help and take care!