Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can't teleport character (HumanoidRootPart)? [SOLVED]

Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local stage = plr:WaitForChild("leaderstats").Stage.Value
		local checkpoint = game.Workspace.Checkpoints:FindFirstChild(tostring(stage))
		warn("TELEPORTING TO STAGE ".. tostring(stage))
		local offset = Vector3.new(0,2.875,0) -- for smooth teleporting
		char.HumanoidRootPart.CFrame = workspace.Checkpoints:FindFirstChild(tostring(stage)).CFrame + offset
	end)
end)

Everytime my character loads in I'm supposed to teleport to my checkpoint but the teleportation doesn't happen and there are no output errors... https://imgur.com/a/s0IWXcX

[EDIT: ITS SOLVED LOOK IN ANSWERS BELOW]

1 answer

SOLVED! Apparently I just had to wait until the character loads in. So I added this line of code before teleporting:

repeat wait() until char.HumanoidRootPart

This discussion is preserved as it was. New answers, comments, and votes are closed.