Hello, I am trying to create a script that awards a badge to people for buying at least one of a group of gamepasses.
Here is the script so far - it does not work.
local BadgeIds = {2124817966}
local PassId = {11140726,11140832,11140859,11140933,11141121,11213177,11213316,11336834,11388381,19579099}
game.Players.PlayerAdded:connect(function(p)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p.UserId, PassId) then
for i,Badge in pairs(BadgeIds) do
game:GetService("BadgeService"):AwardBadge(p.UserId, Badge)
end
end
end)
Could you please help me with what to fix?
Thank you.
You should not ask for whole scripts. But it would be something like this:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")
local BadgeIds = {2124817966}
local PassIds = {11140726,11140832,11140859,11140933,11141121,11213177,11213316,11336834,11388381,19579099}
Players.PlayerAdded:connect(function(p)
for i, passid in pairs(PassIds) do
if MarketplaceService:UserOwnsGamePassAsync(p.UserId, passid) then
for i, badgeid in pairs(BadgeIds) do
BadgeService:AwardBadge(p.UserId, badgeid)
end
end
end
end)