austtm
(YourDailyDev)
March 27, 2024, 3:55pm
#1
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)
Iemny
(Iemny)
March 27, 2024, 3:57pm
#2
That is because the :PivotTo()
function only executes on model
types, not BasePart
s.
Change
character.HumanoidRootPart:PivotTo(…)
to
character:PivotTo(…)
and it should fix it.
PivotTo Engine API
1 Like
wastbo
(DanCodes)
March 27, 2024, 4:13pm
#3
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
austtm
(YourDailyDev)
March 27, 2024, 5:24pm
#4
It still isn’t doing anything.
wastbo
(DanCodes)
March 27, 2024, 7:01pm
#5
Can you send the non-working changed code?
austtm
(YourDailyDev)
March 27, 2024, 9:25pm
#6
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)
wastbo
(DanCodes)
March 27, 2024, 11:29pm
#7
I see it now, you want it so they teleport when the die, or am I wrong
austtm
(YourDailyDev)
March 28, 2024, 12:10am
#8
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
UIScript
(UIScript)
March 28, 2024, 12:18am
#10
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.
austtm
(YourDailyDev)
March 29, 2024, 6:12pm
#11
I ended up changing the system and I no longer need to use :PivotTo. Thank you for all your help!
system
(system)
Closed
April 12, 2024, 6:12pm
#12
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.