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

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)
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