I’m currently working on an AI for my Guest defense like gamemode, so I have the issue that the other AIs are accidentally shooting themselves, what I have tried is to use a pairs code to get the other AI names from a table, something like this:
for _, Name in pairs(Names) do
if ObjectThatGotHitByBullet.Parent.Name ~= Name then
--Damage code here
end
end
However, the problem is that if only one Name is not the name of the NPC, it will damage the other NPC, I don’t know how to fix this, thanks for reading.
What if you simply have the name of the humanoid something like “AI,” then when the when they are shot, if the humanoid has that exact name, don’t deal damage!