I am new to scripting, and I have searched all over the web for this answer. I really need this for a new game I'm making, and yes I already have the animation ready for my game.
You should at least try to make it. I will give you some references:
-Make a while true do loop that isnt so frequent (with a wait time of about 5 seconds is good I guess)
-Reference your NPC. Also reference the character, like this: local char = game.Players.TargetPlayer.Character or game.Players.TargetPlayer.CharacterAdded:Wait(). This way of referencing is good to avoid bugs when character isn't available and also avoid loops with too much frequency.
-Check if character and NPC aren't nill. If nill then repeat the wait for character to reference it or spawn a new NPC and reference it too. Then, check if their distance isn't too far.
Example: if (character.HumanoidRootPart.Position-NPC.HumanoidRootPart.Position).magnitude < 50 then walkfunction end)
-Use Humanoid:MoveTo() when the checks are passed and set the position to your character position, then it will follow you.
-You can make it teleport close to you if its too far away. In this case you can use "else" on the distance check and set the CFrame of the NPC to your character position.
-If you want the enemy to follow you but not so that it gets close enough to touch you, like a zombie, then you can use (character.HumanoidRootPart.Position+character.HumanoidRootPart.CFrame.rightVector*5) on the checks, the humanoid:MoveTo() function and the CFrame teleport, which will in that case make the NPC move 5 studs to your right.