I am trying to make an obby that uses checkpoints and saves the data, i have tested it with my friends but it only teleports me to the stage i left. Help please.
Server Script:
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(char) repeat wait() until Player.Character ~= nil if Stage.Value == 0 then return end local Checkpoint = game.Workspace:FindFirstChild(Stage.Value) if Checkpoint then char:MoveTo(game.Workspace[tostring(Stage.Value)].Position) end end) end)
The checkpoints name are the same as of its stage. No errors.
Thanks. If you want more information ask.
Quite a stupid question.
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(char) repeat wait() until Player.Character ~= nil if Stage.Value == 0 then return end local Checkpoint = workspace:FindFirstChild("Stage") if Checkpoint then char:MoveTo(tonumber(Checkpoint.Value)) end end) end)
tell me if that works.
Fixed it, just saw another youtube video on how to make checkpoints and followed his instructions, here is the final result:
function Teleport(Char) local Player = game.Players:GetPlayerFromCharacter(Char) if Player ~= nil then repeat wait() until Char.HumanoidRootPart ~= nil local ls = Player.leaderstats local sl = game.Workspace:FindFirstChild(ls.Stage.Value) Char.HumanoidRootPart.CFrame = Char.HumanoidRootPart.CFrame + Vector3.new(0,3,0) wait() Char.HumanoidRootPart.CFrame = sl.CFrame + Vector3.new(0,3,0) end end game.Workspace.ChildAdded:Connect(Teleport)
However, anyone who answers why the old script didn't worked and this one yes, it will be marked as answer.