How to make TextLabel disappear when Player has specific badge

As the title suggests; I’ve been having trouble with managing to make this script work. The script is a LocalScript inside of a TextLabel along with a Value titled ID (As seen in the script).

I have checked basically everywhere that I can to find an answer, but I can’t find much.

badgeholder = script.Parent.ID.Value
local badgeservice = game:GetService("BadgeService")

local debounce = true
if badgeservice:UserHasBadgeAsync(script.Parent.UserId, badgeholder) then
			debounce = false
			script.Parent.Visible = false
end

I am still new to scripting like last time, but I have improved a bit more then last time

1 Like

Are there any errors in the output? (Top ribbon, view → Output)

Also, since the localscript only executes on one client at a time, instead of using

script.Parent.UserId

Can’t you just use

game.Players.LocalPlayer.UserId

I checked the output and the only error is for a cutscene plugin that I have, which doesn’t even work anymore

Why are we using debounce?

local badgeHolder = script.Parent.ID.Value
local badgeService = game:GetService("BadgeService")

if badgeService:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, nadgeHolder) then
    script.Parent.Visible = false
end
1 Like