Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local BadgeService = game:GetService("BadgeService")
- local Players = game:GetService("Players")
- local badgeID = 1060922754 -- Change this to your badge ID
- local function onPlayerAdded(player)
- local hasBadge = false
- -- Check if the player has the badge
- local success, message = pcall(function()
- hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeID)
- end)
- -- If there's an error, issue a warning and exit the function
- if not success then
- warn("Error while checking if player has badge: " .. tostring(message))
- return
- end
- if hasBadge == true then
- -- Assign this player a property/indicator that they own the badge
- --
- end
- end
- -- Connect 'PlayerAdded' events to the 'onPlayerAdded()' function
- Players.PlayerAdded:Connect(onPlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement