Hey scripters!
I was wondering if I could get assistance, I want to write a script to detect if the player owns a gamepass, and then if they do, award them a certain badge (I’m doing this so I can add items based on the badge), but I am unable to.
My code is this:
type orlocal MarketplaceService = game:GetService("MarketplaceService")
local badgeService = game:GetService("BadgeService")
local gamepassId = 000000 -- my gamepass id
local badgeId = 000000000 -- my badge id
game.Players.PlayerAdded:Connect(function(Player)
while wait() do
if MarketplaceService:UserOwnsGamePassAsync(Player, gamepassId) then
badgeService:AwardBadge(Player, badgeId)
elseif badgeService:UserHasBadgeAsync(Player, badgeId) then
return
end
end
end)
paste code here
Any ideas on what went wrong? I’ve tried using Ai to help (as the person I normally would Dm for help is away) and it, as expected, is unable to fix the problem.