0

# Why my checkpoint system is just teleporting me to the stages?

Edited 11 months ago

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)
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.

0
i think uhhh u have to use saving on user id idk IEntity_303I 78 — 11mo
0
I already did that. However, thats not the problem. yuni_Boy1234 320 — 11mo
0
What do you mean by 'but it only teleports me to the stage i left'? PeculiarTea 0 — 11mo
0
Well, i am the only one who the script teleports to the stage i left, while others players don't yuni_Boy1234 320 — 11mo

0
7zjh 146
11 months ago
Edited 11 months ago

Quite a stupid question.

game.Players.PlayerAdded:Connect(function(Player)
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.

0
I see the problem now. 7zjh 146 — 11mo
0
The varriable Checkpoint is a Value under workspace and you are trying to get a Position from the value property. If it was a vector3 value, you would just do .Value under the supposed value. 7zjh 146 — 11mo
0
I am sure this will not work, FindFirstChild function checks if a object is in the selected parent (Parent:FindFirstChild()) and its parameter is the object's name, it returns true if it finds, otherwise, it turns false, so you cant do "Checkpoint.Value" since boolean values doesn't have a value property, and on line 7, the move to function needs a vector3 value so it can move a player character. yuni_Boy1234 320 — 11mo
0
Edited 11 months ago

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 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