HumanoidRootPart becomes disassociated from rest of character model after teleport

I am attempting to teleport players between two positions within the same place. I have tried several methods and none of them work correctly. Even though the player appears to have teleported correctly on the client, I’m getting issues like this on the server:

It seems that after the teleport, the HumanoidRootPart is no longer in the same place as the rest of the character model, and I have no idea why. I have tried using HumanoidRootPart.Position, HumanoidRootPart.CFrame, Character:PivotTo(), Character:MoveTo()…nothing works. I still have this weird offset. Everything is fine before the teleport.

1 Like

I have the same problem but weirdly, it didn’t have any consequences after teleporting, I discovered this after publishing the modifications and it worked fine on all clients.

1 Like

For my game, there are consequences because weapons fail to function correctly after the teleport.

1 Like

I was able to fix this using char:MoveTo(). Could you show your code using char:MoveTo()?

Sure.

-- Incoming teleport handler
local function incomingTeleport(player, effect, speed, power)
	suppress = true
	delay(cycleTime, function()
		suppress = false
	end)
	incPlayer = player
	incChar = player.Character
	local human = incChar:FindFirstChild("Humanoid")
	--local root = incChar:FindFirstChild("HumanoidRootPart")
	if soundPowerUp ~= nil then
		soundPowerUp:Play()
	end
	lightUp()
	if soundTeleportIn ~= nil then
		soundTeleportIn:Play()
	end
	if reverseFace == true then
		incChar:MoveTo(position)
		local cf = incChar:GetPivot()
		local ax, ay, az = cf:ToOrientation()
		local newcf = cf * CFrame.Angles(ax, ay + math.pi, az)
		incChar:PivotTo(newcf)
		model.CameraEvent:FireClient(player)
	else
		incChar:MoveTo(position)
		--root.Position = position
	end
	queryResult = true
	setEmitterStatus(true)
	materialize(effect)
	setEmitterStatus(false)
	human.WalkSpeed = speed
	human.UseJumpPower = true
	human.JumpPower = power
	if soundPowerDown ~= nil then
		soundPowerDown:Play()
	end
	lightDown()
end

I use char:PivotTo() because I have to manipulate the CFrame when the ReverseFlag attribute is defined and true. But otherwise, it uses char:MoveTo(). I tried using root.Position but that doesn’t work either. Neither method in the above code works correctly.

character.HumanoidRootPart.CFrame = CFrame.new(yourcframe)
or
character.HumanoidRootPart.CFrame.Position = position

I’ve tried those. Same result.

position isnt defined in your code, either that or something is wrong with the way your game is setting up characters, not the way your teleporting them

try doing this

local target = CFrame.new(50,10,0
CharacterModel:PivotTo(target)
--or if you're not using cframe
local target = Vector3.new(50,10,0)
CharacterModel:PivotTo(CFrame.new(target))

Actually, position is defined globally elsewhere in the script.