RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"I want to limit the number of times certain badges can be obtained for everyone."
-- server script local badgeService = game:GetService("BadgeService") local dataStoreService = game:GetService("DataStoreService") local badgeLimitStore = dataStoreService:GetDataStore("BadgeLimitStore") local badgeId = 123456789 -- replace with your badge ID local badgeLimit = 100 -- replace with the limit you want function awardBadge(player) local currentBadgeCount = badgeLimitStore:GetAsync(badgeId) if currentBadgeCount == nil then badgeLimitStore:SetAsync(badgeId, 1) badgeService:AwardBadge(player.UserId, badgeId) elseif currentBadgeCount < badgeLimit then badgeLimitStore:IncrementAsync(badgeId, 1) badgeService:AwardBadge(player.UserId, badgeId) else print("Badge limit reached") end end game.Players.PlayerAdded:Connect(function(player) -- call awardBadge function when a player joins awardBadge(player) end)