:PivotTo Not Moving Player

I am trying to use the :PivotTo function to move a player after they respawn, but the player isn’t being moved even though “full death” is printing.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if player:WaitForChild("FullDeath").Value == true and player.Team == game.Teams.Runners then
			print("full death")
			character.HumanoidRootPart:PivotTo(CFrame.new(-726.904, 11.423, 32.375))
			player.FullDeath.Value = false
		end
	end)
end)

That is because the :PivotTo() function only executes on model types, not BaseParts.

Change

character.HumanoidRootPart:PivotTo(…)

to

character:PivotTo(…)

and it should fix it.


PivotTo Engine API

1 Like

FYI it does work on BaseParts. The reason it didn’t work is because the rest of the character wasn’t a descendant of the root

1 Like

It still isn’t doing anything.

Can you send the non-working changed code?

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if player:WaitForChild("FullDeath").Value == true and player.Team == game.Teams.Runners then
			print("full death")
			character:PivotTo(CFrame.new(-726.904, 11.423, 32.375))
			player.FullDeath.Value = false
		end
	end)
end)

I see it now, you want it so they teleport when the die, or am I wrong

When they respawn, it should TP them.

maybe some other script/logic is also messing with the position? try putting a small delay before the teleport or doing it on the client and see what that does

This is correct. Even SpawnLocations shouldn’t affect this behavior anymore unless you have a custom spawning script, which in this case it would probably better if you were to merge behaviors to guarantee behavior and ordering or to delay/use CharacterAppearanceLoaded instead.

I ended up changing the system and I no longer need to use :PivotTo. Thank you for all your help!

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