Player to stage not working

Hello, I have an obby game and I want the player to teleport to the stage they are on when they join. However it is not working and I do not know what is wrong with it. Here is my current code:

game.Players.PlayerAdded:Connect(function(plr)
	wait(.1)
	local val = plr.leaderstats.Stage.Value
	for _,v in pairs(workspace.Checkpoints:GetChildren()) do
		if v.Name == val then
			plr.Character:FindFirstChild("HumanoidRootPart").CFrame = v.CFrame
		end
	end
end)

Try this :

game.Players.PlayerAdded:Connect(function(plr)
	wait(.1)
	local val = plr.leaderstats.Stage.Value
	for _,v in pairs(workspace.Checkpoints:GetChildren()) do
		if v.Name == val then
			plr.Character:PivotTo(v.CFrame)
		end
	end
end)
2 Likes

Still does not work. rrrr34444444r

2 Likes

Oh sorry :

game.Players.PlayerAdded:Connect(function(plr)
	wait(.1)
	local val = plr.leaderstats.Stage.Value
	for _,v in pairs(workspace.Checkpoints:GetChildren()) do
		if tonumber(v.Name) == val then
			plr.Character:PivotTo(v.CFrame)
		end
	end
end)
2 Likes

What it is? I never seen this in a post. People more often do:
[spoiler]This text will be blurred[/spoiler]

character limit. normally i do this:
uiwerweuirywieuro under the post but i had a seizure there so um yea lol

1 Like

Anyways you shouldn’t use characters limit bypass because if there’s a character limit, there’s a reason.

1 Like

Personnaly I flag all posts that have a character limit bypass. Except posts that are essential to the topic, like this one:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.