I was wondering how I would make a gamepass thats bought in-game work without having to rejoin.
Example: If you buy a +15 speed gamepass in-game how would you make it work without rejoining the game.
I was wondering how I would make a gamepass thats bought in-game work without having to rejoin.
Example: If you buy a +15 speed gamepass in-game how would you make it work without rejoining the game.
Use PromptGamePassPurchaseFinished. It is an event that will let you fire something after the player has been prompted to buy the game pass.
I don’t know what you want the player to do to be prompted to buy the game pass, so let’s just pretend here that a button, the script’s parent, is clicked (that's why this is in a LocalScript).
local player = game.Players.LocalPlayer
local gamepassID = -- put your ID here
local MarketplaceService = game:GetService(“MarketplaceService”)
script.Parent.MouseButton1Click:Connect(function() -- You can edit this to suit your needs
MarketplaceService:PromptGamePassPurchase(player, gamepassID) -- This part is probably already in your script
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassID, wasPurchased) -- wasPurchased is a bool value which tells you whether or not the player bought the game pass
if wasPurchased == true then -- if player did buy game pass
-- your code here
else
return
end
end
end
(Sorry if the formatting looks weird. I’m not used to doing this on phone right now. I will edit if necessary.)
If you have any questions, I’ll try to reply as soon as I can!
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
you could have a script that checks if the player has bought the game pass every so often.
^