-
What do you want to achieve?
Hello, i store players in a table and i want to give all players in the table a badge -
What is the issue?
I can’t manage to do it -
What solutions have you tried so far?
I looked on forums and tried myself.
4 Likes
local players = game:GetService("Players")
local badges = game:GetService("BadgeService")
local awardBadge = bagdes.AwardBadge
local badgeId = 0
local function awardBadges()
for _, player in ipairs(players:GetPlayers()) do
local success, result = pcall(awardBadge, badges, player.UserId, badgeId)
if success then
if result then
print("Badge "..badgeId.." awarded to "..player.Name..".")
end
else
warn(result)
end
end
end
4 Likes
local badgestoreward = {0,0,0} -- ur ids
local userid = 0 -- user id for player
for _,v in pairs(badgestoreward) do
game:GetService("BadgeService"):AwardBadge(userid,v)
end
4 Likes