What do you want to achieve? I want to prevent an NPC from killing and chasing teh other NPC.
What is the issue? I don’t know how to do that, though I just want the NPC to stop chasing the other one. I don’t need the “Cancelling Damage” script.
What solutions have you tried so far? I looked for some posts but they’re just not it.
I also wanna know this so I can learn more about scripting and/or if I or my friends wanna make some other games.
If you already have a script that is controlling the NPCs now it would help if you could share it so we can understand what the script is doing that you wish to change.
Could you share your AI script?
Run an if statement to see whether or not the target is a player or not.
It should work then
here is an idea, check if it chases a player (edit
local player = game.Players:GetPlayerFromCharacter(put character that the npc is chasing here)
if player then
--do your code here
For your target search function, instead of looping through all Humanoids in workspace, you should loop through
game:GetService("Players"):GetPlayers() which returns an array of all the players.
if not game.Players:GetPlayerFromCharacter(NPC) then