I have the part here: https://gyazo.com/afd73a7fec4f7d097e99a3dcb95d2076 And it does work, but the problem is only once, when the ai walked into the other one it damaged him but only that time then it just did nothing. Example: https://gyazo.com/6789f6f4c1fc9d7a6552cd3add2f3338 (It did damage it, it just healed before I could get it in the gif) How do I fix it??
script.Parent.Touched:connect(function(part) local humanoid1 = part.Parent:FindFirstChild("Humanoid") local humanoid2 = part.Parent.Parent:FindFirstChild("Humanoid") if humanoid1 then humanoid1:TakeDamage(script.Parent.Damage.Value) end if humanoid2 then humanoid2:TakeDamage(script.Parent.Damage.Value) end end)
Try this;
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(script.Parent.Damage.Value) elseif hit.Parent.Parent:FindFirstChild("Humanoid") then hit.Parent.Parent.Humanoid:TakeDamage(script.Parent.Damage.Value) end end)
Might work.
Put a part in ReplicatedStorage and put this script in it :
script.Parent.Touched:connect(function(part) local humanoid1 = part.Parent:FindFirstChild("Humanoid") local humanoid2 = part.Parent.Parent:FindFirstChild("Humanoid") if humanoid1 then humanoid1:TakeDamage(script.Parent.Damage.Value) end if humanoid2 then humanoid2:TakeDamage(script.Parent.Damage.Value) end game.ReplicatedStorage.PARTNAME:Clone().Parent = game.workspace end)
And put another part with this script in workspace.
I hope it helped !