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.
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:
1 | local gamepassId |
2 | function OnGamePassPurchase(player, gamePassId, wasPurchased) |
3 | if (gamePassId = = gamepassId and wasPurchased) then |
4 | print (player.Name, " purchased the game pass!" ) |
5 | --put the code to give player a reward |
6 | end |
7 | end |
8 |
9 | MarketPlaceServce.PromptGamePassPurchaseFinished:Connect(OnGamePassPurchase) |
learn more here