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

So, I’m working on a spawn script that choses a random model’s BasePart and sets the characters position to it.

I’ve noticed despite adding safeties like Character:WaitForChild("HumanoidRootPart") it doesn’t make PivotTo or MoveTo work on the character.

The character just sits on top of the SpawnLocation.

game.Players.PlayerAdded:Connect(function(Player)
	print("PlayerAdded!")
	Player.CharacterAdded:Connect(function(Character)
		print("CharacterAdded!")
		Character:WaitForChild("HumanoidRootPart")
		print("RootPart!")
		local ChosenGuideModel = GuideModelList[math.random(1, #GuideModelList)]
		local TargetCFrame = ChosenGuideModel.PrimaryPart.CFrame
		Character:PivotTo(TargetCFrame)
		print("MoveTo!", TargetCFrame)
	end)
end)

When this is ran, I get this output:

Not sure if I’m missing something here but I do remember vividly that this used to be a functional thing.

I’ve also tried adding Player.CharacterAppearanceLoaded:Wait() which didn’t work.
I’ve noticed that adding a wait(1) sometimes works sometimes doesn’t but it’s not a solution I’m entirely happy with.

1 Like

Have you tried waiting for target cframe part?

1 Like

As you can see, the output displays a complete CFrame.
The GuideModel is positioned before being parented to workspace aswell.

At the very minimum, the CFrame value outputted should not have my character sitting at the SpawnLocation.

1 Like

try adding waitforchild for humanoid

2 Likes

Nothing changed so far.

303030

1 Like

What is it exactly doing?

is it not teleporting?

2 Likes

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