CFrame set during CharacterAdded gets overridden

I want a player to spawn at a specific location in the world. When I try to move them during the CharacterAdded event, they teleport to a different location the following frame.

This is reproducible on a baseplate: CharacterAddedTeleport.rbxl (18.0 KB)

Code:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(ch)
		print("added")
		ch:SetPrimaryPartCFrame(workspace.Spawn.CFrame)
		print(ch.PrimaryPart.Position)
		wait()
		print(ch.PrimaryPart.Position)
	end)
end)

Output:

added
-6.13999939, 2.75444603, -11.4400043
0, 103.710884, 0

The character teleports to a default spawn location the following frame. This behavior is very surprising. Is it possible for Roblox to move the character to the default spawn location before firing the CharacterAdded event?

It’s painful for me to handle delaying setting the character’s CFrame because if one of my scripts executes before that, the character being in the wrong location can incorrectly trigger game events. Any work around suggestions would be appreciated.

4 Likes

This is a known issue that will be fixed when the new Avatar Loading Order becomes active.

I’m actually curious as to why it isn’t out yet though. :frowning:

Edit: forgot you’re in need of a work around. For now you have to rely on the waiting method, which is kind of not good but works around the issue. You could either delay it by 1 second before cframing, or you could wait until the HumanoidRootPart exists in the character.

5 Likes

what I do is like rootpart:GetPropertyChangedSignal(‘Position’):Wait() and then position people.

2 Likes

This is still an issue today…

4 Likes