What's wrong with this?

  1. What do you want to achieve?

I want to make an NPC that follows a player but does not attack.

  1. What is the issue?

I’m not sure why my code is wrong.

  1. What solutions have you tried so far?

I’ve looked at countless tutorials and tried many different things.

Here is my code:

local NPC = game.Workspace.NPC

local humanoid = NPC.Humanoid

while True do

MoveTo(game.Workspace.HeeboKid.HumanoidRootPart)

end

Can someone tell me what’s wrong with this? I’m a new scripter and would appreciate some help.

1 Like

Hello. In your code which you presented, there are 2 mistakes. I will tell you each one of them:

  1. When you typed ‘true’ in the 5th line, you used a capital letters in the ‘true’, which is ‘True’, you may change this to ‘true’, I’m not sure if it’s causing any error, but it probably is a reason.

  2. ‘MoveTo’ is a built-function. You must first reference what you want to move, or else the script will not know what to move. In this case you need to reference a Humanoid when using ‘:MoveTo()’ function. Try to do ‘Humanoid:MoveTo(argument)’.

Please message me for further support.

Thank you,
XDvvvDX.

1 Like