Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to check if player has died?

when player health reaches 0 he gets kicked from the server

LocalScript inisde StarterPlayerScripts

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
function kick()
	player:kick("You Died")
end
-- what command do I need to use?

2 answers

✓ Accepted answer

There are a bunch of ways to do this; but here's one! you can use the Humanoid.Died() function

local player = game:GetService("Players").LocalPlayer
player.CharacterAdded:Connect(function(character)
	character:WaitForChild("Humanoid").Died:Connect(function()
		player:kick("You Died")
			print(player.Name .. " has died!")
		end)
	end)


Another way to do this is by checking: If the health is equal to 0 then kick them.

Thanks: - JesseSong

This discussion is preserved as it was. New answers, comments, and votes are closed.