function Fire() print("Slow Kill!") local players = game.Players:GetChildren() for i=1,#players do if players[i].Character ~= nil then print("...") players[i].Character.Humanoid.Health:TakeDamage(1) end end end while wait(.5) do Fire() end
Also, can you please see if there is a more efficient way of doing this? There probably is and i'm just stupid.
players[i].Character.Humanoid.Health:TakeDamage(1)
You use TakeDamage() on the Humanoid, not the health. So
players[i].Character.Humanoid:TakeDamage(1)
function Fire() print("Kill em all!") local players = game.Players:GetChildren() for i=1,#players do if players[i].Character ~= nil then print("...") players[i].Character.Humanoid.Health:TakeDamage(100) --simple mistake end end end while wait(.5) do Fire() end
It works but you're only making them take 1 damage. When you need 100 to kill.
And for a more efficient method I would do this:
function Fire() for i, v in pairs(game.Players:GetChildren() do if v.Character then v.Character.Humanoid.Health = 0 end end end while wait(.5) do Fire() end
now for a slow death:
function Fire() for i, v in pairs(game.Players:GetChildren() do if v.Character then repeat v.Character.Humanoid.Health = v.Character.Humanoid.Health - 1 wait(.1) until v.Character.Humanoid.Health = 0 -- may be a double = im not sure. I don't use repeats alot end end end while wait(.5) do Fire() end