HumanoidRootPart CFrame not changing on character spawn

I’ve done this and everything prints, thought I am not teleported unless I add the wait.

This did not work either, unfortunately.

Idk if this is work but you can do

repeat
HumanoidRootPart.CFrame = Part.CFrame
until HumanoidRootPart.CFrame = Part.CFrame

Im on phone and not sure if it works

This is basically your task.wait, it repeats until the humanoidrootpart cframe is equals to the part cframe

Okay. I’ve made my own script , see if this works.

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
local part = workspace.Part

character:MoveTo(part.Position)
end)
end)

uhhhh MoveTo dosent teleport the player, it just walks the player’s character to that point…

I think you might be talking about character.Humanoid:MoveTo()

Unfortunately this is pretty much identical to what I’m doing and doesn’t work either.

oh right, sorry I should have paid attention

Alright I think I might have found the solution.

local RunService = game:GetService("RunService")

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
print("character added")
end)

local part = workspace.Part

plr.CharacterAppearanceLoaded:Wait()

RunService.Stepped:Wait()

plr.Character:SetPrimaryPartCFrame(part.CFrame)
end)

I see no reason why this wouldn’t work, seems like a roblox bug, something messing with it or its something out of my knowledge, I rewrote the code and it works now:

game.Players.PlayerAdded:Connect(function(player)
	local character
	character = workspace:WaitForChild(player.Name)
	character:WaitForChild("HumanoidRootPart").CFrame = workspace.Part.CFrame
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("HumanoidRootPart").CFrame = workspace.Part.CFrame
	end)
	
end)

Don’t use HumanoidRootPart.CFrame use something like Character:MoveTo().

is not RootPart.CFrame same as Character:MoveTo()
edit: nvm MoveTo changes the position while CFrame both the position and rotation, so yeah moveTo would be btter to use if we are teleporting the character

Yes it is. But its gonna cause a lot of bugs later on. For example I used that in a game of mine and when i wanted to use body movers like .Velocity or BodyVelocity it just teleported the player into the void. While your script DOES work. You really should use character:MoveTo().

game.Players.PlayerAdded:Connect(function(player)
	local character
	character = workspace:WaitForChild(player.Name)
	character:MoveTo(workspace.Part.Position)
	player.CharacterAdded:Connect(function(character)
		character:MoveTo(workspace.Part.Position)
	end)
	
end)
1 Like

Unfortunately I think you may have to use task.wait/wait before you teleport the player because of how loading a player’s character works. :frowning:

This would’ve been resolved if this was made live

From what I’ve read, if you want 100% reliability without any loops or using wait methods - you’ll have to use the Player.RespawnLocation property on Player’s - which can only use a SpawnLocation Part which is a bit weird.

1 Like

That’s so unfortunate :smiling_face_with_tear: Thanks for the reply & deep diving into the forum for me! I’ll look into the RespawnLocation thing however, as my player should only need to spawn once in the entire time in the game & it’s at the very moment they join the game. I hope they plan on releasing the update sometime soon - it feels like it would solve quite a few of my issues!

1 Like

Ended up using this method & for the way my game functions - it’s far more reliable and exactly what I wanted, so thanks for the help!

Little side-note for you;

The CharacterAppearanceLoaded is very unreliable to use, as it can probably stop the entire script if used incorrectly, just use CharacterAdded, as you’re only accessing the parts inside the character, not the “appearance”.

Sorry about that , but I just found out about that function. But thank you for telling me.

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