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

How do I create a follow script for an Enemy NPC that chases the users around?

I am pretty new with Lua, so be nice...

I have put in my research/time in trying to figure this out, but can't seem to figure out the full answer. What I want is for an enemy to follow the user around within a closeish-range. The first problem that I ran into was that my friend was a R15 model and I had to change Torso to HumanRootPart - Solved. The second and largest problem was that I was using the typical find nearest torso on Humanoids, but soon realized that the enemy would start chasing after the NPC's in the background. Please help me with code snippets! Thank you for the help in advance.

1 answer

✓ Accepted answer

Just change the UpperTorso name or the Non-Enemy NPC Torso to "N_PC" and the Enemies to "E_NEMY", you can change the names to whatever you want, but keep the script for UpperTorso or the Torso, will be corrected.

"Why Latine?" : It happened because the Enemy is attacking everything that has a Torso or HumanRootPart with those names, I change it, the script will detect it as "false" bool and will not do anything, but will cause the Enemy to attack and follow the Upper Torso or Player's Torso.

1 comment

0

@Latine_Lemonade What part of this script do i change to HumanRootPart, and what part do I change to N_PC and E_NEMY - please help

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