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

How to make a following script?

I've been trying to make a follow script for a zombie game but it just won't follow. I am also using a mesh (not charactermesh) so i think thats the problem. This is the code i made to make it move:

script.Parent:MoveTo(game.Players.Character.Torso)

But it still doesn't move! I need help. NOTE: I did not anchor it

1 comment

0

Try adding .Position after Torso. And then you might also want to loop this in a while true do loop. Just because the player's Torso position can change a lot. Also, is the script inside the Humanoid of the zombie. MoveTo is a function only Humanoids can access. 

1 answer

✓ Accepted answer

Wait, you said that you're using a mesh, by that did you mean that you're just using one part? Not a humanoid? The script that you're attempting would require the parent to have a humanoid. If it's a singular part without a humanoid inside it, then :MoveTo() wouldn't work. Also, that line of code would probably need to be looped if you wanted the zombie to continually chase the player.

If you're only using one part and you want to have that part chase the player, this is a pretty good tutorial: http://wiki.roblox.com/index.php?title=Scripting_Book/Chapter_3

As a reminder, MoveTo() should only be used when the parent of the script has a Humanoid.

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