RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"I want to limit the number of times certain badges can be obtained."
-- server script local badgeService = game:GetService("BadgeService") local badgeLimit = 5 -- change this to your desired limit local badgeId = 123456789 -- change this to your badge ID local badgeCount = {} -- a table to store how many times each player has received the badge game.Players.PlayerAdded:Connect(function(player) badgeCount[player.UserId] = 0 -- initialize the player's badge count to 0 end) function awardBadge(player) if badgeCount[player.UserId] < badgeLimit then badgeService:AwardBadge(player.UserId, badgeId) badgeCount[player.UserId] = badgeCount[player.UserId] + 1 else print("Player has reached the badge limit.") end end -- call the awardBadge function when you want to award the badge to a player -- awardBadge(game.Players.UserId)