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. :/

1 comment
No! line 9 is not the player but it is the player's character!