Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I scan if someone has a specific badge? [closed]

Asked by
J4k3y101 -28
4 years ago

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

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
rabbi99 714 Moderation Voter
4 years ago

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

01local BadgeService = game:GetService("BadgeService") -- Get the service
02local player = -- Where your player is
03 
04local badgeID = 00000000  -- Change this to your badge ID
05 
06local function Check(player)
07    -- Check if the player has the badge
08 
09    local hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeID) -- either true or false
10 
11    if hasBadge then
12        return true
13    else
14        return false
15    end
16end
17 
18local PlayerHasBadge = Check(player)
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? Ziffixture 6913 — 4y
0
return BadgeService:UserHasBadgeAsync(player.UserId, badgeID). Bam Ziffixture 6913 — 4y
Ad