Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I scan if someone has a specific badge?

Like a script that scans if someone has a specific badge and if they do a gui pops up.

1 answer

Always search for information before asking. There's clearly an example on the Developer page of Roblox.

I hope this helps. https://developer.roblox.com/en-us/api-reference/class/BadgeService

local BadgeService = game:GetService("BadgeService") -- Get the service
local player = -- Where your player is
 
local badgeID = 00000000  -- Change this to your badge ID
 
local function Check(player)
	-- Check if the player has the badge
	
	local hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeID) -- either true or false
 
	if hasBadge then
		return true
	else
		return false
	end
end
 
local PlayerHasBadge = Check(player)

2 comments

0

Fam.... HasBadge is already a Boolean, why would do use an conditional (which requires a Boolean) to return a Boolean of the identical state of the Boolean HaseBadge?

0

return BadgeService:UserHasBadgeAsync(player.UserId, badgeID). Bam

This discussion is preserved as it was. New answers, comments, and votes are closed.