LocalScript that checks if a player has this badge doesn't work? [CLOSED]
Asked by
1 year ago Edited 1 year ago
im making a local script that checks if a player has this badge, it does something to a text button if so
this, is the script:
01 | local BadgeService = game:GetService( "BadgeService" ) |
02 | local Players = game:GetService( "Players" ) |
04 | local badgeId = 2143097943 |
06 | local function onPlayerAdded(player) |
07 | local success, hasBadge = pcall ( function () |
08 | return BadgeService:UserHasBadgeAsync(player.UserId, badgeId) |
12 | warn( "Error while checking if player has badge!" ) |
17 | script.Parent.Frame.FortressButton.Text = "FORTRESS" |
18 | script.Parent.Frame.FortressButton.HasBadge.Value = true |
22 | Players.PlayerAdded:Connect(onPlayerAdded) |
this local script is inside a screengui, and it doesn't work.
there is no errors in the output, i tried looking for solutions but cant find one.
any help is appreciated!