Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why will this simple MoveTo() script not function on a Humanoid?

In Workspace, there is a Model named "Player" and in it a brick Named "Part2" along with a humanoid named "Humanoid". There is also a part named "Part" located in Workspace as the target. The script should make Player move to Part:

while wait(.1) do
Workspace.Player.Humanoid:MoveTo(Workspace.Part.Position, Workspace.Part)
end

(This is written in a regular script in Workspace) ...When ran, however, the brick does not move, and no message appears in the Output declaring I have done something wrong. I have checked the official ROBLOX forums / wiki and researched across the web, but haven't found a solution. I inserted a Mob into my place to see if the MoveTo() function itself was working, and the mob moved without flaw. The MoveTo() function will work with just Vector3 Coordinated, Teleporting Player to Part.

So why is this not working for me? All answers appreciated, Thank You very much. ~Xduel

1 comment

0

Note: MoveTo() only works on Models

1 answer

The function ":MoveTo()" only works on models. If you are trying to move a player from 'Players' first you have to get the players character by saying 'player.Character' then using the moveTo function. It should look like this:

while wait() do
 wait(0.1)
 game.Players.PlayerName.Character:MoveTo(0,0,0) -- set to coorinates.
end

~Sweetpea11fir

3 comments

0

No, moveTo does work on humanoids, that's how mobs are made to follow a character or point.

0

Oh, My bad. I only use it on models... Your problem is with this Workspace.Player.Humanoid:MoveTo(Workspace.Part.Position, Workspace.Part)

1

Try just doing 'game.Workspace.Player:MoveTo(game.Workspace.Part.Position)' That should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.