I’m trying to check whether or not a certain player is banned, but it just wont work.
local Success, Error = pcall(function()
repeat
ID = math.random(1,50)
print(game.Players:GetPlayerByUserId(ID))
local Info = MarketPlaceService:GetProductInfo(ID)
until game.Players:GetPlayerByUserId(ID) ~= nil
end)
If you don’t want to use web APIs you can try this hacky method.
You can pcall game.Players.GetCharacterAppearanceInfoAsync, as it throws HTTP 400 (Bad Request) if you use it on a banned player. You can probably find other methods that do the same.
local function is_banned_by_roblox(id)
return not pcall(Players.GetCharacterAppearanceInfoAsync, Players, id)
end
This is hacky for a few reasons:
Future changes to the implementation of this method might break your game logic; this is not the intended functionality so you can’t really expect them to keep it this way.
You can’t guarantee that all bad requests are the result of the player being banned.
For a production game I would recommend using Roblox’s API and only resorting to this when it is unavailable (like right now). I’ve also never used this in a real game so I have no idea if any issues might be amplified by things like request count.