Player sometimes doesnt spawn at stage

image

copy paste the code. Dont just put a screenshot. No one can help with the code being like this.

HRP.CFrame = CFrame.new(checkpoint.Posiition + Vector3.new(0,3,0))

change it to

HRP.Position = checkpoint.Posiition + Vector3.new(0,3,0)

From my understanding, Roblox loads in the character model before its children. This implies that you must wait until the HumanoidRootPart exists before changing the location of the character.

Also, note that a more effective way to relocate a character is by using the :SetPrimaryPartCFrame function of the model.

repeat game:GetService("RunService").Heartbeat:Wait() until character.PrimaryPart --Wait for primarypart of character to exist
character:SetPrimaryPartCFrame(CFrame.new(checkpoint.Position + Vector3.new(0,3,0)) --Change CFrame

Hope this helps. Let me know if you have any questions.

1 Like

Better yet, use “:PivotTo()”.

1 Like

Neat! I didn’t know about this.

I was making an obby with my friend and we found this was the best way to teleport the player.

local function characterAdded(character)
	if not character.Parent then
		character.AncestryAdded:Wait()
	end

	...
end