Is their a way to check if a Player Dies, and then `kick` them = )

Hello! So Im trying to make a Elimination game, Ok neverminded by now you get the point if you saw my last post... Lastly, Im trying to make it so when the player dies they get kicked from the game, here’s the current script to check if the player died lol

while true do
	game.Players.LocalPlayer.Died:Connect(function(player)
		print("An maybe idiotic player named: "..player.Name.." Has died. Maybe lag or mcdonalds wifi, idk...")
		player:Kick("Dude you died you big dum dum!")
		print("The player has been Kicked!")
	end)
end
4 Likes
while true do
    wait()
    if game.Players.LocalPlayer.Character.Humanoid.Health == 0 then
	 print("An maybe idiotic player named: ".. game.Players.LocalPlayer.Name.." Has died. Maybe lag or mcdonalds wifi, idk...")
	  game.Players.LocalPlayer:Kick("Dude you died you big dum dum!")
	  print("The player has been Kicked!")
   end
end
2 Likes

Loads of syntax errors : |

ops i forget the “if”

I’m editing wait

while true do wait()
    if game.Players.LocalPlayer.Character.Humanoid.Health == 0 then
	 print("An maybe idiotic player named: "..player.Name.." Has died. Maybe lag or mcdonalds wifi, idk...")
	  game.Players.LocalPlayer:Kick("Dude you died you big dum dum!")
	  print("The player has been Kicked!")
   end
end

player has a syntax error, W001: Unknown global ‘player’

game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
    game.Players.LocalPlayer:Kick()
end)
3 Likes

I fixed already in first comment, try this script here

1 Like

The Parentheses Has a syntax error

oh its only remove in

here in this end

Fixed

I alr know the basics

Ik how to print

print("Abcdefg")

Ik about local functions

local function EpicFunctionGuy()
    print("SOCOOL")
end)

ik about much more things

I just need to learn more about the player functions and stuff…

Please don’t assume = /

Ik about beyond printing lol.

as I stated…

Ik built in functions like Clone() and Destroy()

all Im saying its best to not assume, also please don’t get of topic with me its not helpful

1 Like

It didn’t seem to work, also I have this in ServerScriptService

Hey! This script should be helpful to you. It should be a server script and preferably placed in ServerScriptService. You could make this a local script which only listens to characters of the client that then kicks itself, but that is vulnerable to manipulation.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character.Humanoid.Died:Connect(function()
			player:Kick("You died!")
		end)
	end)
end)

Essentially, we check for whenever a player joins and then listen to when a character is added for said player! When that character dies, we kick the player associated with the character!

If you need any more clarification with how it works, let me know! :grinning_face_with_smiling_eyes:

5 Likes

Wait, correct me if I’m wrong, I think you can only use :Kick() on the server side, and my intention was to put a LocalScript inside the StarterGui.

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

Once again, this is very off topic to the original topic that I posted, that’s why I stopped replying.

It works, thanks for the script!

1 Like

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)