So I made an ability for an NPC, but every time it uses it, it gets damaged. How would I make it where it wouldn’t damage itself?
if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("AlreadyHit") and not hit:IsDescendantOf(NPC.Humanoid) then
local enemyHumanoid = hit.Parent:FindFirstChild("Humanoid")
local alreadyHit = Instance.new("BoolValue")
alreadyHit.Parent = hit.Parent
alreadyHit.Name = "AlreadyHit"
enemyHumanoid:TakeDamage(35)
In the if statement add this line: and hit.Parent ~= NPC
Just replace NPC with however you defined your NPC, or if the script is under the NPC you can just do script.Parent