For those wondering, here’s what the join error message looks like.
wish it would say “Banned” at the top
For those wondering, here’s what the join error message looks like.
wish it would say “Banned” at the top
By far the best api addition in a very long time. Thank you!!
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.
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
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).
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
I think an API like this is great, I’ve been waiting for it for months
FINNALY… Im so exited to have this being implemented into games to remove annoying alts. Thanks Roblox!
That’s exactly the cool option I ment, you can provide ExcludeAltAccounts
and set it to true or false!
Great addition, excited to implement.
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!
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
.
Hooray! Finally, I really waited for something like hardware ban. Thanks to engeneering team for implementing this feature!
I made an update to the default script
local Players = game:GetService("Players")
-- Example function to determine if a player should be banned
local function shouldBeBanned(player)
-- Implement your ban logic here
return true -- Replace with your actual logic
end
-- Example function to calculate ban duration based on ban history
local function getNextBanDuration(banHistoryPages)
-- Implement your logic to calculate ban duration based on ban history
return 3600 -- Replace with your actual logic (e.g., check ban count, severity, etc.)
end
-- Example usage of banning a player
local function banPlayer(player)
if shouldBeBanned(player) then
local banHistoryPages = Players:GetBanHistoryAsync(player.UserId)
local duration = getNextBanDuration(banHistoryPages)
local config = {
UserIds = {player.UserId},
Duration = duration,
DisplayReason = "You violated community guideline #5",
PrivateReason = "Exploiting + insult",
ExcludeAltAccounts = false,
ApplyToUniverse = true
}
local success, err = pcall(function()
Players:BanAsync(config)
end)
if not success then
warn("Failed to ban player:", err)
else
print("Player banned successfully")
end
else
print("Player should not be banned")
end
end
-- Example: Connect to PlayerAdded event to monitor new players
Players.PlayerAdded:Connect(function(player)
-- Example: Wait for 5 seconds before checking if the player should be banned
wait(5)
-- Example: Call the ban function
banPlayer(player)
end)