[Solved]MoveTo script not working?

So I have a MoveTo script which moves a humanoid to positions. The code does run, as the code after it runs. The character is unanchored, and I see no problems. My code:

  local npc = game.Workspace.Beetlejuice
  npc.Humanoid:MoveTo(Vector3.new(111.554, 106.66, -26.17))

Any help is appreciated.

2 Likes

I generally almost always use the HumanoidRootPart when moving a player just because I’ve found it to be less buggy maybe that will help? Just throwing it out there :slight_smile:

Try to do it directly on the NPC. Do take note this code will actually instantly teleport the model though. If you want the model to walk (which is what :MoveTo() does when ran on a Humanoid) you would need to review the better example below.

Example:

local npc = game.Workspace.Beetlejuice
npc:MoveTo(Vector3.new(111.554, 106.66, -26.17))

Your code should work though. Here is a working example I made, it could possibly be an issue where the character wasn’t fetched correctly; here is an example that stays on the basis of what you were looking for.

Better Example:

game.Players.PlayerAdded:Connect(function(Player) 
	wait(3)
	
    -- Same concept just it will always have access to the player's character.
	Player.Character.Humanoid:MoveTo(Vector3.new(111.554, 106.66, -26.17))
end)

If you have any questions feel free to ask, I hope this helped. :+1:

1 Like

I personally use :MoveTo() on Character models. Not on Humanoids.
Try using :MoveTo() on the Model, not the Humanoid.

He’s trying to move an NPC, not a player’s character.

1 Like

I tried this on a empty baseplate and it worked, but on the real game, it didn’t seem to work, just teleported?

1 Like

I solved it, I just had to anchor everything in the model then unanchor it lol.

An NPC will work the same way as a character.

1 Like