Hi there. I am working an an obby game, and yet again have stumbled upon a problem. Everything with the checkpoint system is working except for teleporting to a checkpoint when the player joins (Saved within DataStore). Can somebody please help? My code is here:
game.Players.PlayerAdded:Connect(function(plr)
local waitforleaderstats = plr:WaitForChild('leaderstats')
if waitforleaderstats ~= nil then
local ls = plr.leaderstats
local rl = plr.RespawnLocation
local cp = game.Workspace.Checkpoints
if ls.Stage.Value == 0 then
rl = cp.Checkpoint1
elseif ls.Stage.Value == 1 then
rl = cp.Checkpoint1
elseif ls.Stage.Value == 2 then
rl = cp.Effortless.Checkpoint2
elseif ls.Stage.Value == 3 then
rl = cp.Effortless.Checkpoint3
elseif ls.Stage.Value == 4 then
rl = cp.Effortless.Checkpoint4
elseif ls.Stage.Value == 5 then
rl = cp.Effortless.Checkpoint5
elseif ls.Stage.Value == 6 then
rl = cp.Effortless.Checkpoint6
elseif ls.Stage.Value == 7 then
rl = cp.Effortless.Checkpoint7
elseif ls.Stage.Value == 8 then
rl = cp.Effortless.Checkpoint8
elseif ls.Stage.Value == 9 then
rl = cp.Effortless.Checkpoint9
elseif ls.Stage.Value == 10 then
rl = cp.Easy.Checkpoint10
elseif ls.Stage.Value == 11 then
rl = cp.Easy.Checkpoint11
elseif ls.Stage.Value == 12 then
rl = cp.Easy.Checkpoint12
elseif ls.Stage.Value == 13 then
rl = cp.Easy.Checkpoint13
elseif ls.Stage.Value == 14 then
rl = cp.Easy.Checkpoint14
elseif ls.Stage.Value == 15 then
rl = cp.Easy.Checkpoint14
end
end
end)
Sorry that it's long, couldn't think of any other way to do it.

2 comments
where's the teleport script ?
did you set a gui?