Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to award a badge by buying a gamepass?

Asked by 2 years ago

I want to make a gamepass where if you buy it, once you join the game you are awarded a badge for owning the gamepass, any tips on how to make this possible?

Thank you!

1 answer

Log in to vote
0
Answered by 2 years ago
local BadgeService = game:GetService("BadgeService")
local MarketplaceService = game:GetService("MarketplaceService")
function PlrJoin(player)
    local gamepassid = [YOUR GAMEPASS ID]
    local badge_to_award_ID = [ID OF THE BADGE YOU WANT TO AWARD] 
    local PlayerBoughtThisGamePass =  MarketplaceService.UserOwnsGamePassAsync(player.UserId, gamepassid)
    if PlayerBoughtThisGamePass == true then
        BadgeService:AwardBadge(player.UserId, badge_to_award_ID)
    end
end
game.Players.PlayerAdded:Connect(PlrJoin())

i belive that should work

0
Thank you so much! Ghostinee 27 — 2y
Ad

Answer this question