Introducing the Ban API and Alt Account Detection

This is very exciting news! Finally, we’re starting to win back ground in the war against cheaters :tada:

opencloud integration + all these features on bans is really incredible

For those wondering, here’s what the join error message looks like.

image

wish it would say “Banned” at the top

14 Likes

By far the best api addition in a very long time. Thank you!!

1 Like

Oh yippee, this is neat.
Wiping exploiters is gonna be a lot simpler now.

I’m very grateful for this wonderful update!

This is super useful! I quickly set up a test to see how it works.

  1. If player is in-game when they’re banned, they see a normal kick message with the DisplayReason shown.
  2. A banned player joining is instantly rejected, seemingly before they can even connect to the server at all.
  3. Alt account detection isn’t working for me during tests at all. I’ve tested across three different accounts: one made years ago, one made a few days ago, and one just now created. None were detected.
3 Likes

I love this, it’s way more convenient than making a ban system yourself

This is a great idea I’m glad this is happening

Finally ban system is added after ignoring developer requests for years

finally no more day requirements etc and we can just ban players fully! +1 great feature

Finally don’t have to use our own alt detection system right, @CodedJer? :pray:

1 Like

PrivateReason = “Put anything here that the user should not know but is helpful for your records”,

The documentation mentions that there is a “private reason” and a “display reason”.

Does the private reason need to be filtered? I am thinking of possible use-cases for this, such as using it to link evidence (e.g. images uploaded to imgur).

2 Likes

I think it’s probably just connected to accounts with the same email, if not and it is using ip then you might be correct

Oh hell yeah.

This will be super useful, the only effective way previously was to limit account age, which isn’t all that great because it stops people who are genuinely new to the platform from getting to your game.

this sounds awesome

great update!!!

I am not reading all the replies so do tell if I missed something crucial lol

1 Like

I think an API like this is great, I’ve been waiting for it for months :pray:

1 Like

FINNALY… Im so exited to have this being implemented into games to remove annoying alts. Thanks Roblox!

1 Like

That’s exactly the cool option I ment, you can provide ExcludeAltAccounts and set it to true or false!

1 Like

Great addition, excited to implement.

1 Like

I am super excited for this to be added! I have been advocating for a feature like this for quite a while, and I love to see it be implemented!

1 Like

Why is the ban reason subjected to text filter? It makes no sense to me when you can put anything you want in the kick reason, as well as for practically anything else in the game. If the reason is supplied dynamically by moderators, that should be developer’s responsibility to filter the text before feeding it into the ban async function.

Also, I don’t see any way to remove ban record from the ban history, I think it would be nice to be able to remove it for false bans, or bans made when testing live.

It should be like this:

--!strict

local Players = game:GetService("Players")
local TextService = game:GetService("TextService")

local function filterTextForUserAsync(
	text: string,
	senderId: number,
	receiverId: number,
	context: Enum.TextFilterContext
): string?
	-- Prepare the text filter
	local textFilterObj: TextFilterResult? = nil

	local success, err = pcall(function()
		textFilterObj = TextService:FilterStringAsync(text, senderId, context)
	end)

	if not textFilterObj or err then
		return
	end

	-- Filter the text
	local filteredText: string? = nil

	local success, err = pcall(function()
		filteredText = textFilterObj:GetNonChatStringForUserAsync(receiverId)
	end)

	if not filteredText or err then
		return
	end
	
	return filteredText
end

-- There is a reason to filter text here since the reason is supplied dynamically
-- by approved moderators in the game, but since you are not willing to take responsibility
-- for their ban reasons, you will properly filter it via Roblox provided text filter API
local function banUserViaAdminPanel(
	targetUserId: number,
	moderatorUserId: number,
	moderatorSuppliedReason: string,
	moderatorSuppliedDuration: number
): (boolean, string)
	local filteredModeratorSuppliedReason = filterTextForUserAsync(
		moderatorSuppliedReason,
		moderatorUserId,
		targetUserId,
		Enum.TextFilterContext.PrivateChat
	)
	
	if not filteredModeratorSuppliedReason then
		return false, "Supplied reason was either filtered or failed to filter"
	end
	
	local success, err = pcall(function()
		Players:BanAsync({
			UserIds = {targetUserId},
			ApplyToUniverse = true,
			Duration = moderatorSuppliedDuration,
			DisplayReason = filteredModeratorSuppliedReason,
			PrivateReason = "They misbehaved",
			ExcludeAltAccounts = false
		})
	end)
	
	if err then
		return false, "An error occured when attempted to ban the user"
	end
	
	return true, "User was banned successfully"
end

-- There is no reason to filter text here since the reason is hardcoded
-- this is true for any piece of text that you have control over,
-- and willing to take responsibility for it
local function automaticBan(targetUserId: number): ()
	local success, err = pcall(function()
		Players:BanAsync({
			UserIds = {targetUserId},
			ApplyToUniverse = true,
			Duration = -1,
			DisplayReason = "Some good reason that should not be filtered",
			PrivateReason = "Whatever you want here",
			ExcludeAltAccounts = false
		})
	end)

	if success then
		-- Successfully banned the player
	end
end

Also, shouldn’t ExcludeAltAccounts be IncludeAltAccounts based on the language used in other places? In the past Roblox had Disabled property but it was replaced with Enabled.

6 Likes

Hooray! Finally, I really waited for something like hardware ban. Thanks to engeneering team for implementing this feature!

2 Likes