The script is inside of the npc. the npc is cloned in through a button, giving the npc a string value of the player who cloned the npc's team (player1 is on purple team, player1 clicks button and npc is cloned in, a string value is added with the value of "purple") . The npcs have follow scripts with target npcs of different teams. problem is the damage script either can't find the opposing npc's humanoid or another problem i don't know about
function dmg(hit)
if hit ~= nil then
local npcTeam = script.Parent.Team.Value
local enemyTeam = hit.Parent.Team.Value
local enemyHuman = hit.Parent:FindFirstChildOfClass("Humanoid")
if npcTeam ~= enemyTeam then
enemyHuman.Health = enemyHuman.Health - 10
end
end
end
hitbox.Touched:Connect(dmg)

1 comment
no error, but no damage is being done