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

How to make your game kick a player when they die?

For my game, I need a kick-on-death script that has a GUI at the end that says "You died" and whatnot. The thing is I'm not a scripter and I can't find tutorials anywhere. I've found a Death then Kick script in the ROBLOX Library, but it doesn't work. Can someone paste the script for me and explain how to make the GUI?

1 answer

So You Could Use A Script In Starter Player Scripts That Will Check To See If They Have 0 Health Then Kick Them.

  • Make A Local Script And Put It In StarterPlayerScripts

Now Put This Code Into The Local Script.

local plr = game.Players.LocalPlayer
function kick(reason)
plr:Kick(reason)
end
while wait() do
if not plr.Character then
-- They Are Probably Exploiting or There Character Is = Nil/Null --
kick("Do Not Exploit!")
else
if not plr.Character:FindFirstChild("Humanoid") then
kick("Do Not Exploit!")
else
if plr.Character.Humanoid.Health == 0 then
kick("You Died :(") -- Kick them If they have died -- You can put a custom message inside the speech marks! --
else
-- They Haven't Died --
end
end
end
end

If You Still Need Help You Can Contact Me On Twitter @harry_theking1 Or On Discord: Harry_TheKing1#2303

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