PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

Kick

The Kick 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.

##Example
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.

Getting kicked without a message.

Calling this method on a player but providing a string as the first argument will replace this message with the contents of the string.

Getting kicked with a message.

Parameters

Name Type Default Description

The message to show the player upon kicking.

Returns

Return Type Summary

No return.


Code Samples


Kick Command

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.