Player.Character:PivotTo(CFrame)/:MoveTo(Vector3) not Working

No teleporting, my character sits at the SpawnLocation on the Baseplate instead of being ontop of the target part.

1 Like

Sitting is likely the problem
force the character to jump before trying

2 Likes

Added Character.Humanoid.Jump = true after Character:WaitForChild("Humanoid") still no change.

1 Like

Try editing sitting property

also could I see the full script?

1 Like

Not needed, you can remove the local variables and fill in a CFrame value for PivotTo

game.Players.PlayerAdded:Connect(function(Player)
	print("PlayerAdded!")
	Player.CharacterAdded:Connect(function(Character)
		print("CharacterAdded!")
		Character:WaitForChild("Humanoid")
		Character.Archivable = true
		print("RootPart!")
		Character:PivotTo(CFrame.new(-100, 0, 100))
		print("MoveTo!")
	end)
end)

I have this as a script inside ServerScriptService.

I don’t think anyone can figure this out without the rest of the code

1 Like

I mean the one I just provided that has no reference to any other code breaks the same by itself.
So I’m not sure what to tell you.

I have no other client code that is messing with the character nor server code.

Could you setup a demo place?

: )

1 Like

example.rbxl (34.4 KB)

This behavior just got even weirder my friend.

I added a repeat until with a magnitude check and it passed the repeat but still I showed up at the SpawnLocation this may be a bug report in the making.

game.Players.PlayerAdded:Connect(function(Player)
	print("PlayerAdded!")
	Player.CharacterAdded:Connect(function(Character)
		print("CharacterAdded!")
		Character:WaitForChild("HumanoidRootPart")
		print("RootPart!")
		local TargetCFrame = CFrame.new(-100, 0, 100)
		repeat
			Character:PivotTo(TargetCFrame)
		until (Character.HumanoidRootPart.Position - TargetCFrame.Position).Magnitude <= 10
		print("MoveTo!", TargetCFrame)
	end)
end)

This worked for me

game.Players.PlayerAdded:Connect(function(Player)
	print("PlayerAdded!")
	Player.CharacterAdded:Connect(function(Character)
		print("CharacterAdded!")
		Character:WaitForChild("HumanoidRootPart")
		print(Character.HumanoidRootPart.Position)
		Character.Archivable = true
		print("RootPart!")
		task.wait()
		print(Character.HumanoidRootPart.Position)
		Character.HumanoidRootPart:PivotTo(CFrame.new(-100, 0, 100))
		print(Character.HumanoidRootPart.Position)
		print("MoveTo!")
	end)
end)
1 Like

Huh. When using inside serverscript, it doesn’t work. When placed inside localscript like this (parented to game.StarterPlayer.StarterPlayerScripts), it works

local LocalPlayer = game.Players.LocalPlayer
print("Player added!")
LocalPlayer.CharacterAdded:Connect(function(chr)
	print("Character added!")
	chr:WaitForChild("HumanoidRootPart")
	print("HumanoidRootPart added")
	chr:PivotTo(CFrame.new(0, 1, 1000))
end)

RobloxStudioBeta_sleoGzcnVa
I see that for some strange reason the server sends the signals before the client.

Yeah I feel like this behavior that I’m dealing with wasn’t intended.
I’m surprised no one brought it up.

The client controls the character
perhaps it is being overridden by the client as how soon it is ran on the server
but that is the client so it works

Huh, that actually worked. I can’t believe it!
Thank you.

This is still a very weird issue to be dealing with so I’m going to be making a bug report.

What’s even more weirder is as @Carrotoplia had mentioned, task.wait() works:

game.Players.PlayerAdded:Connect(function(Player)
	print("PlayerAdded!")
	local Character = Player.Character or Player.CharacterAdded:Wait()
	print("CharacterAdded!")
	Character:WaitForChild("HumanoidRootPart")
	Character:WaitForChild("Humanoid")
	print("RootPart!")
	task.wait()
	Character:PivotTo(CFrame.new(0, 1, 1000))
	print("MoveTo!")
end)

Don’t forget to mark @Carrotoplia’s post as solution if it worked!

1 Like

Already did no worries!

303030

im pretty sure its being overridden if done too fast
task library is more efficient and communicates with the stuff running roblox better

Agreed.

If anyone else needs to know about the task library, check this announcement.