How To Make A Attacking NPC?

Hi i need help with scripting a npc :confused:
so i want that the npc is attacking people like a enemy npc

----------------------------------what i need as help---------------------------------------
-attacking script and where to add it’
-other things and where to add it


^ This should help, please look for all avaliable solutions before making a post.
You can also use Magnitude, Zone+, Raycasting for detection.
Zone+ | Retrieving players within an area/zone


This isn’t much information to go on - how do you expect the NPC to attack; melee or ranged? How do you want it to acquire targets? Do you want it to be mobile, and how much if so?

As for your question of where to place your NPC’s scripts, it depends on whether you only have one NPC or if you want more. If it’s the latter, you’ll want to give your NPCs a tag using CollectionService and have a single script in ServerScriptService that controls anything with the NPC tag.


thx for the links but idk how to find it , the names like pathfinding -> how can i know that this says about the npc, because of this i am making post about it :confused:

but this links doesnt have the script of the attacking npc what i wanted is the scripts and the other things i need to make a attacking npc but this shows the zone and the pathfinding…
not the attacking script or the other things

You should at least try and make the script and if you have a problem go to the DevForum. Pathfinding is very simple, you can literally copy the one on the DevHub and then edit it to your likings. If you want to make it when the NPC touches a player the player loses health, that’s easy also.

1 Like

the problem is i cant script mate

If you can’t even script, why try to do advanced stuff? I don’t get it.


if everyone can script, why are they using devforum, i dont get it


You cannot ask for people to provide you scripts here, if you want someone to script for you please go to:

1 Like

Here is a youtube tutorial:
It’s not really a tutorial, just shows you how to put it together with pre-made scripts, but I guess that’ll do it for you since you don’t script, as you said.


guys ive already made with scripts thx for helping all, its done its solved

Great! Next time try searching tutorials on youtube before asking as it makes it easier for everybody.

i did but it didnt work but i saw that i have forgot to add something