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

How do i make it so when a player owns a gamepass then they get a badge?

The badge id is 2125977058 and the gamepass id is 27455846

2 answers

✓ Accepted answer
local Players,mps=game.Players,game:GetService"MarketplaceService"
local BadgeService=game:GetService("BadgeService")

local function awardBadge(player)
	if not BadgeService:UserHasBadgeAsync(player.UserId,2125977058)then
		BadgeService:AwardBadge(player.UserId,2125977058)
	end
end
mps.PromptGamePassPurchaseFinished:Connect(function(player,gpid,wasPurchased)
	if wasPurchased and gpid==27455846 then
		awardBadge(player)
	end
end)
local function onPlayerAdded(player)
	wait()
	if mps:UserOwnsGamePassAsync(player.UserId,27455846)then
		awardBadge(player)
	end
end;Players.PlayerAdded:Connect(onPlayerAdded)
for _,v in ipairs(Players:GetPlayers())do 
	onPlayerAdded(v)
end;

For one, this isnt a website to request scripts being made for you.

But to achieve this, you would need to use MarketPlaceService to check whether the uses owns the gamepass and then use BadgeService to award it.

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