Hi. I was curious on how I would award a badge to every player in the server. Thanks.
COMMUNITY QUESTION
How do I award badges to every player in the server?
2 answers
Try this
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local badgeID = 0000000 -- Change this to your badge ID
local function awardBadge()
local player = Players.LocalPlayer
local hasBadge = false
-- Check if the player already 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 == false then
BadgeService:AwardBadge(player.UserId, badgeID)
end
end
Easy!
local Id = 0--Type Id here
local BS = game:GetService("BadgeService")
local Value = false
while true do
if Value == true then
for i, plr in pairs(game.Players:GetPlayers) do
BS:AwardBadge(plr.UserId,Id)
end
end
wait(1)
end
If you set the Value to true, everyone will get the badge! Enjoy!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
It depends how you want the badge to be given
I wanted it to be awarded to everyone, no matter what. I think that's what you mean.