So i have a code that opens a door when 1 npc dies but i need it to only open when 2 or more certain npcs die. So for example, when 1 npc dies the door stays closed, but when the other one dies the door opens.
function door()
local open = script.Parent.Health
local doorr = game.Workspace.part3
if open <1 then
doorr.Transparency = 0.5
doorr.CanCollide = false
end
end
script.Parent.Died:Connect(door)
I put this in the npc's humanoid

1 comment
Just make a global variable that increases when an npc is killed, then make sure the value of the variable is 2 or more if you want. To make a global variable: _G.VariableName = 0