So I made an NPC that attacks other people how can I make that it doesn't attack the owner or someone specific? I currently have this as my chase script:
01 | wait() |
02 | zombieParent = false |
03 |
04 | while zombieParent = = false do |
05 |
06 | wait() |
07 | if script.Parent.Name = = "Knight" then |
08 | zombieParent = true |
09 | end |
10 |
11 | end |
12 |
13 | local larm = script.Parent:FindFirstChild( "Left Arm" ) |
14 | local rarm = script.Parent:FindFirstChild( "Right Arm" ) |
15 | local waitTimer = 0 |
This is a relatively simple solution, as where you can use conditional statements (also known as if statements) to determine things.
Here's a sample:
1 | if 1 + 1 = = 2 then |
2 | print ( "Math" ) |
3 | else |
4 | print ( "Math Broke" ) |
5 | end |
So here, it will always print math since 1 + 1 is equivalent to 2. The concept is similar to imply into your script:
1 | if Target.Name ~ = "person" then |
2 | -- do not attack |
3 | else |
4 | -- attack |
5 | end |
So where you get your target (assuming you know the script also assuming you made it), check the player or target via name or player user id if it is a player and then you will be done!
Hope this helped, best of luck!