How to check if a player is banned in a script

I don’t know if there’s a way within roblox studio to do this sadly, not sure what the use case would be either as they are unable to access your game due to their platform ban.

Banned players cannot join games at all bruh

You can check with the UsersApi /v1/users/{userId} returns an “isBanned” value, which tells you whether that user is banned or not.

1 Like

I want to make a graveyard kind of thing.

1 Like

There is actually an available API for this. Here’s the script I wrote.

local http = game:GetService("HttpService")

local baseUrl = "https://users.roproxy.com/v1/users"

local function checkIfTerminated(userId)
	local payload = {
		["userIds"] = {userId},
		["excludeBannedUsers"] = true
	}
	
	local success, result = pcall(function()
		return http:JSONEncode(payload)
	end)
	
	if success then
		if result then
			local success2, result2 = pcall(function()
				return http:PostAsync(baseUrl, result)
			end)
			
			if success2 then
				if result2 then
					local success3, result3 = pcall(function()
						return http:JSONDecode(result2)
					end)
					
					if success3 then
						if result3 then
							if result3.data[1] then
								return false
							else
								return true
							end
						end
					else
						warn(result3)
					end
				end
			else
				warn(result2)
			end
		end
	else
		warn(result)
	end
end

local isTerminated = checkIfTerminated(1) --Roblox's ID.
print(isTerminated) --false
isTerminated = checkIfTerminated(8166491) --1x1x1x1's ID.
print(isTerminated) --true

https://users.roblox.com/docs#!/Users/post_v1_users

This was the API endpoint I used, it has an optional parameter which allows for you to exclude banned users from the query, this can be used to determine if a user is banned or not.

2 Likes

I think this is what you are looking for. API To check whether User is banned? - #2 by ReturnedTrue

banned players cannot join games,
did you mean to check if they got banned before?

Read my topic desc, it says I want to know if they are banned off of Roblox entirely.

That’s the same API endpoint I used.

you cant

just check the players username like Gameboy5704 and look up their player id. Just search their name in the search players box at the front page and search their username. if their profile picture/avatar doesnt show up in the search results then their banned

uhhh you can do that actually, but you need Roblox API for this (and if you’re going to use it inside Roblox, just use API proxy like roproxy.com)

{
  "description": "string",
  "created": "2022-02-21T03:41:16.874Z",
  "isBanned": true,
  "externalAppDisplayName": "string",
  "id": 0,
  "name": "string",
  "displayName": "string"
}

(returned body example from /v1/users/{userId})

You cannot join games if you are banned on ROBLOX. To save a ban just for your game, save it as a Boolean, and check if it’s true when they join.

he never wanted to kick people who were banned on Roblox

You sure?
“I WANT TO KNOW IF THEY ARE BANNED OFF OF ROBLOX ENTIRELY” in my eyes mean if they are currently banned or terminated.

he said he wanted to do that to make a graveyard for peoples who were banned (or something like that)

(I don’t know how he will get the UserId)

OH. I suppose that would be a bit hard to tell, you’d have to loop threw all 2.5 billion accounts to check.

1 Like

Do these strings just determine things by using just strings? You’ll have to use a player’s id or database inside the script

I was thinking like a graveyard for my friends, I can easily get their id’s off of the website because they aren’t currently banned.

2 Likes

that’s the example I copied from the API docs

I actually discovered a weird way to find if player is banned using MarketplaceService

local Marketplace = game:GetService("MarketplaceService")
local function PlayerBanned(UserId)
	local success, data = pcall(function ()
		return Marketplace:UserOwnsGamePassAsync(UserId,12345) --Any random Gamepass ID
	end)
	
	print(data)
	--Prints "The specified user does not exist!" if banned
	--Prints "false" if player exist (or "ture" if player owns it)
	if not success and data ~= true then
		return true
	end
	return false
end

print(PlayerBanned(1)) --Roblox => false
print("-----------")
print(PlayerBanned(27)) --rich(banned) => true
print("-----------")
print(PlayerBanned(8166491)) --1x1x1x1(banned) => true

Note: It’s not totally reliable