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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Ad

Answer this question