I've been looking for a checkpoint script for my obby since the one I tried doing myself doesn't work no matter what I try. I came across a script here:
function oa(object) local player = game.Players:playerFromCharacter(object) if player ~= nil then local ls = player.leaderstats local sl = game.Workspace:FindFirstChild(ls.Stage.Value) print("obby") object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0) wait() object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0) end end game.Workspace.ChildAdded:connect(oa)
I understand most of the script, but I don't understand how sl can have a CFrame. Can someone please explain it to me? Thank you!
Edit: I've looked it over more, and I see that line 9 doesn't make sense. The player is in game.Players, not the Workspace, so line 9 returns nil. I've seen it work for others, but I don't understand how it works. :/
The "sl" is most likely a SpawnLocation/Checkpoint or a part, since its in Workspace. If you need more of an explanation, don't hesitate to ask!
Edit:
I just looked at your script again, and I think I see a problem
Line 2: local player = game.Players:playerFromCharacter(object)
should be replaced with local player = game.Players:GetPlayerFromCharacter(object)
.
Hopefully that helps!