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

How do I make script where when someone buys an game pass they get some sort of effect?

Hello, I'm building my simulator and I want to add a feature so when you buy a game pass you get a lightning effect (I already made) and I'm wondering do I make that kind of script.

1 answer

you can register an event handler on the MarketPlaceServce.PromptGamePassPurchaseFinished event. It fires whenever a gamepass is bought (inside a game BTW).

so something like this:

local gamepassId
function OnGamePassPurchase(player, gamePassId, wasPurchased)
	if(gamePassId == gamepassId and wasPurchased) then
		print(player.Name," purchased the game pass!")
		--put the code to give player a reward
	end
end

MarketPlaceServce.PromptGamePassPurchaseFinished:Connect(OnGamePassPurchase)

learn more here

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