How to check if a player is banned in a script

I want a script that can check a specific player’s Userid and see if they have been banned or not as a bool value. I WANT TO KNOW IF THEY ARE BANNED OFF OF ROBLOX ENTIRELY! I couldn’t find anything about this topic, I only got things about ban panels and how to kick people so I thought I would make a topic about this.

Please reply to this topic if you have any answers or ideas.

Research the DataStoreService, it lets you have data persisting across sessions. Ideally you would store the userids of banned people, then check if they are in the list when they join the game, if they are then :Kick()

1 Like

If you just want a basic script where you manually set if they’re banned you could create a table of user ids and check when users join if their id matches one in the list, if it does then you could kick them.

Wiki links:

https://developer.roblox.com/en-us/api-reference/event/Players/PlayerAdded
https://developer.roblox.com/en-us/api-reference/function/Player/Kick

2 Likes

I want to know if they are actually banned on Roblox, not just in my game.

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