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 1 year 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 1 year ago
Edited 1 year 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