Collapse Sidebar


Checks whether a Player owns a articles/Badges Special Game Awards|badge given their Player/UserId|UserId and the badge ID. This query can only be made under the following conditions:

  • This function must be called from a server-side Script or a ModuleScript eventually required by a Script, not from a LocalScript.
  • The player in question must be present in the server.

Any badge for any game can be queried, no matter who created the badge or which game it is used for.

See also

  • BadgeService/GetBadgeInfoAsync|BadgeService:GetBadgeInfoAsync()
  • BadgeService/AwardBadge|BadgeService:AwardBadge()


Name Type Default Description

The Player/UserId of the player to check for ownership of the specified badge.

The badge ID of the badge whose ownership will be checked.


Return Type Summary

A boolean indicating if the specified user has the specified badge.

Code Samples

Checking Earned Badges

The following script waits for any player to enter the game and checks if they own a specific badge. This is useful for creating a articles/Collision Filtering Team Doors|restricted area or articles/Teleporting Between Places|teleporter that only works if a player owns a special badge.

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

local badgeID = 00000000  -- Change this to your badge ID

local function onPlayerAdded(player)
	-- Check if the player has the badge
	local success, hasBadge = pcall(function()
		return BadgeService:UserHasBadgeAsync(player.UserId, badgeID)

	-- If there's an error, issue a warning and exit the function
	if not success then
		warn("Error while checking if player has badge!")

	if hasBadge then
		-- Handle player's badge ownership as needed

-- Connect "PlayerAdded" events to the "onPlayerAdded()" function