I have a problem with the checkpoints in my hobby, everything is working normally except that for some reason when I died at any checkpoint reappeared at the spawn.
here is my script
local checkpoints = workspace:WaitForChild("Checkpoints")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local v = Instance.new("IntValue")
v.Name = "Stage"
v.Value = 0
v.Parent = leaderstats
plr.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
wait()
char:MoveTo(checkpoints[v.Value].Position)
hum.Touched:Connect(function(hit)
if hit.Parent == checkpoints then
if tonumber(hit.Name) == v.Value +1 then
v.Value = v.Value +1
end
end
end)
end)
end)
If it doesnât work every time can you send your current script or look at your output for any errors? Saying it doesnât work doesnât really help to pinpoint the problem.