Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by
Xduel 211 Moderation Voter
10 years ago

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

0
Note: MoveTo() only works on Models ObscureEntity 294 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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

0
No, moveTo does work on humanoids, that's how mobs are made to follow a character or point. Xduel 211 — 10y
0
Oh, My bad. I only use it on models... Your problem is with this Workspace.Player.Humanoid:MoveTo(Workspace.Part.Position, Workspace.Part) ObscureEntity 294 — 10y
1
Try just doing 'game.Workspace.Player:MoveTo(game.Workspace.Part.Position)' That should work. ObscureEntity 294 — 10y
Ad

Answer this question