BanService¶
Inherits Instance
BanService lets a game server ban and unban players by their account. Bans are stored on the platform per game, so they persist across server restarts and rejoins. Banning calls only take effect on the server.
Example usage:
-- Permanently ban a player
BanService:BanPlayer(player, "Cheating")
-- Ban for one hour (3600 seconds)
BanService:BanPlayer(player, "Spamming", 3600)
-- Lift a ban
BanService:UnbanPlayer(player)
Static Class
This object is a static class. It can be accessed like this: BanService.
Additionally, it cannot be created in the creator menu or with Instance.New().
Not newable
This object cannot be created by scripts using Instance.New().
Methods¶
BanPlayer → nil¶
Bans the player and kicks them. Pass a positive durationSeconds for a temporary ban, or omit it (or use -1) for a permanent ban. Server only.
UnbanPlayer → nil¶
Parameters: player [ Player ]
Removes an active ban for the player. Server only.
IsBanned → boolean¶
Parameters: player [ Player ]
Returns true if the player currently has an active ban for this game.