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

How can i kick a player when they die?

i am trying to kick a player out of the server when he/she 's HP = 0 ,so they can't respawn anymore...

1 comment

1

Please accept an answer

2 answers

✓ Accepted answer

Upon the players death this will kick them

--//  Author: EnzoTDZ_YT
--//  File: PlayerDiedKick.lua

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Character.Humanoid.Died:Connect(function(Death)
			Player:Kick("You Died")
		end)
	end)
end)

Put in serverscriptservice as a regular script btw didnt know people already answered i had this page open with no answers sorry if it looks like i copied.

1 comment

0

As my answer works please accept

Keep in mind that this is not request site but as this is very simple I will make it for you:

This should be in normal script placed in ServerScriptService(best choice) or Workspace

game.Players.PlayerAdded:Connect(function(Player) -- Detects when a player joins
	Player.CharacterAdded:Connect(function(Character) -- Detects when his character is addded
		Character:WaitForChild("Humanoid").Died:Connect(function() -- And when he died it will kick him
			Player:Kick("You died!")
		end)
	end)
end)

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