Skip to content
Search/
CyberMax › Answers

How to ban someone from your Roblox game (Players:BanAsync)

Updated 2026-11-12 · Roblox and game developers · by CyberMax

Short answer

In a server Script, call Players:BanAsync with the player's UserId, a Duration in seconds (-1 for permanent) and ApplyToUniverse = true so the ban covers every place in your experience. Roblox stores the ban and kicks the player for you. To only remove someone from the current server, call Player:Kick("reason"). Undo a ban with Players:UnbanAsync.

  1. Put the ban code in a server Script (bans never run from a LocalScript).
  2. Check the admin's UserId on the server before banning.
  3. Call Players:BanAsync with UserIds, Duration (seconds, -1 = permanent) and ApplyToUniverse.
  4. Give a DisplayReason the player sees and a PrivateReason for your own records.
  5. Use Players:UnbanAsync to lift a ban, or Player:Kick for a one-server removal.

Copy-paste code

ServerScriptService/Bans.server.lua

local Players = game:GetService("Players")

local ADMINS = { [123456] = true } -- your UserIds

local function ban(admin, target, minutes, reason)
	if not ADMINS[admin.UserId] or not target then return end
	local ok, err = pcall(function()
		Players:BanAsync({
			UserIds = { target.UserId },
			ApplyToUniverse = true, -- every place in this experience
			Duration = minutes and minutes * 60 or -1, -- seconds; -1 = permanent
			DisplayReason = reason or "Breaking the rules",
			PrivateReason = "Banned by " .. admin.Name,
			ExcludeAltAccounts = false,
		})
	end)
	print("[ban]", admin.Name, "->", target.Name, minutes or "perm", ok, err)
end

local function unban(userId)
	Players:UnbanAsync({ UserIds = { userId }, ApplyToUniverse = true })
end
See Gavelwick

Good to know

This is for banning players from a game you own. Scripts that claim to ban people in other people's games are exploits and break Roblox's Terms.

Use UserIds, not names: names can be changed.

Kick only removes the player from that server; they can rejoin. BanAsync keeps them out until the ban ends.

Gavelwick Admin Commands icon

Gavelwick Admin Commands: Admin commands with ranks, bans and a log

from $7

Gavelwick is a tested admin kit with timed and permanent bans synced across servers, ranked permissions (user ids, group ranks, Game Passes, owner), 38 commands and an audit log of every action.

Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)

Questions

What is the difference between kick and ban in Roblox?

Player:Kick removes someone from the current server only. Players:BanAsync stops them joining again, for a set time or permanently.

Can I ban someone for a set time?

Yes: Duration is in seconds, so 1800 is 30 minutes and -1 is permanent.

How do I unban someone?

Call Players:UnbanAsync with their UserId (and the same ApplyToUniverse setting).

Can I see who was banned and why?

Players:GetBanHistoryAsync returns a player's ban history; keep your own log of which admin banned whom, too.

Free: the Roblox Starter Kit

7 free Luau modules (damage, pets, shop formatting, admin audit log, tycoon guards and more) plus 3 free calculators, then 5 short emails with the scripting fixes we see go wrong most often.

You get one email to confirm first. Then the kit, and 5 short emails over two weeks. One-click unsubscribe in every email; we never share your address.

Compare the options

Roblox admin systems compared: tested commands vs admin panel UIsGavelwick vs two Roblox admin panels on itch.io: published prices, ranks, bans, logs and server-side checks.

Related answers

Roblox admin commands script with ranks (for your own game)Add :kick, :tp and :speed admin commands to your own Roblox game with TextChatService, a rank check by UserId A Roblox DataStore save script that never wipes player dataCopy-paste Luau for loading and saving player data with DataStoreService: retries, UpdateAsync, BindToClose an