Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a player leave a game when they die?

Asked by 6 years ago

iv tried multiple things but none works, this is what I have so far but I cannot find where the player's health is so it wont trigger if they reset, Please help. Here is the script

function waitForChild(parent, childName) local child = parent:findFirstChild(childName) if child then return child end while true do child = parent.ChildAdded:wait() if child.Name==childName then return child end end end

function onDied() endgame:GetService("TeleportService"):Teleport(1520637787,game.Players.LocalPlayer) end

Humanoid.Died:connect(onDied)

Please help if you know how

0
Please use code blocks! AwesomeUniverseYT 56 — 6y

1 answer

Log in to vote
0
Answered by
otto045 41
6 years ago

This will kick the player when he died

 game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
    player:Kick("Change this") -- Change this to the kick message.
end)
end)

end)
0
Thanks :) bubyspp1 5 — 6y
Ad

Answer this question