if humanoid.Health == 0 or humanoid.Health < 0 then
for index, player in pairs(game.Players:GetPlayers()) do -- go thru every single player
player:Kick("e") -- kick the player
end -- end the for loop
end
This is my script. Even if my humanoid rig get’s to zero or below zero I do not get kicked from the game.
Currently the code you’ve supplied will only run one time. You’ll need to place it in a loop or just check when the player dies and kick them.
Here is an example:
while true do
if humanoid.Health == 0 or humanoid.Health < 0 then
for index, player in pairs(game.Players:GetPlayers()) do
player:Kick("e") -- kick the player
end
end
end
-- or
humanoid.Died:Connect(function()
for index, player in pairs(game.Players:GetPlayers()) do
player:Kick("e") -- kick the player
end
end)
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if humanoid.Health == 0 or humanoid.Health < 0 then
for index, player in pairs(game.Players:GetPlayers()) do -- go thru every single player
player:Kick("e") -- kick the player
end -- end the for loop
end
end)