Player method allows a game to gracefully disconnect a client from the game and optionally provide a message to the disconnected player. This is useful for moderating abusive players. When used in conjunction with a
DataStore, it is possible to create ban lists with expiration dates. Only allow specific whitelisted users whom you trust to trigger this method on other players.
When used from a
LocalScript, only the local player’s client can be kicked.
When calling this method on a Player with no arguments, they will be disconnected from the server and receive the default message: This game has shut down.
Calling this method on a player but providing a string as the first argument will replace this message with the contents of the string.
The message to show the player upon kicking.
This code sample allows the creator of a place to kick other players by chatting “/kick xyz”, where xyz is the exact username of a player.