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

Disconnection Message Upon Dying?

Asked by 4 years ago

I want the player to be disconnected when they die.

1 answer

Log in to vote
0
Answered by 4 years ago

Call the Kick() method of player when the character dies. You can detect when a player dies using the Died event of humanoid.

Example:

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(char)
        char:WaitForChild("Humanoid").Died:Connect(function()
            player:Kick()
        end)
    end)
end)
0
can you add a reason? theneverwas_kid 12 — 4y
0
Yes, you can pass a string in as the argument of the function, and it will display on the top red bar that appears when the player is kicked—like so: player:Kick("You have died.") VinnyTheButcher 278 — 4y
Ad

Answer this question