How to make a gun npc

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

A gun npc that reacts to player hiding or running away from it by playing a sound or anything to detect it.

  1. What is the issue? Include screenshots / videos if possible!

the issue is that i dont really know how to make a gun npc with features which i want.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

there are no topics about the thing i want.

If there are no topic on the devforum search on youtube then: Roblox - Advanced Soldier AI Tutorial w/ Pathfinding [Part 2] (Pathfinding + Custom Animations) - YouTube this is something similar to your thing i suppose?

1 Like

Its perfect but i want it to have the feature to detect if the player is trying to run away or try to hide.

ooh now that is very tough. I suppose the base idea is if the players delta distance from the npc is increasing drastically? and if the player is behind something (using raycast)? this would take a long time to code though.

Here is an idea:

  1. Make a folder in workspace and name it “Triggers”
  2. Add a few parts and name them Trigger1, Trigger 2 etc
  3. Make sure to make the Transparency of all Trigger parts to 1 and uncheck “Can Collide”
  4. Add a “Sound” to your NPC and put the sound id in the “SoundID”
  5. Add a script in your NPC
  6. Find or make a script that makes your NPC play an animation & play the sound in it when a player is in one of the trigger areas/parts
    if you also want the player to die you can also script that the players health becomes 0
1 Like

I have a question. How do i link a video in a specific timeline? Cause i wanna show what i really want.

just mention its time like 1:20 or 3:40 ill just head to it because in devforum there is no way as far as i know

i will link it very soon. like maybe now.


time is 28:08

1 Like

wait so your just saying an npc that just stands still and if a player gets in his fov he just says “stop right there bucko” ???

No i just cant find a video where the player is chased by the npc.

but i found it already so im gonna link it

uhhhh i still dont understand what you want (;‘_’)

i finally found it WJAZD MTF! | SCP: Containment Breach [#10] #Bladii #Horror #PL - YouTube
at 12:45 also at 11:34 or 11:35 the npc talks

ah so an npc with a gun that follows you where ever you go right? and doesnt loose track of you?

yeah and it needs to be accurate btw at 11:34 or 11:35 the npc talks so you can check it

ok i wont tell you to use roblox pathfinding because its crap so get a pathfinding script from the internet use it and make an npc follow the path.

1 Like

There is no single tutorial that will help you with this, you would have to combine multiple tutorials.
But if you decompose what you want, you will need:

  • NPC with eyes
  • NPC shooting with guns
  • NPC pathfinding to players
  • Sound Detection

Search for tutorials or posts on the forum individually and combine them all into a single script or multiple.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.