Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to award a badge by buying a gamepass?

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

✓ Accepted answer
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

1 comment

0

Thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.