I heard a short while ago that there was a new way to detect whether a player had bought a gamepass without them having to rejoin the game. However, I'm not sure of the process (or services) to get this.
1 | RepStore = game:GetService( "ReplicatedStorage" ) |
2 | Handler = RepStore:WaitForChild( "Handler" ) |
3 | if Handler:InvokeServer( 266469588 ) then -- GAMEPASS ID HERE |
4 | script.Parent.Parent.Spawn.Visible = true |
5 | script.Parent.Visible = false |
6 | script.Parent.Parent.Parent.OwnedBikes.Bike 15. Bike 15. Visible = true |
7 | end |
This is my current script that I have in a Local Script on my game's main menu GUI, how would I make it instantly hide if the player owns the gamepass?
Cheers,
Michael
I think gamepass can't be instantaneous. I think what you heard was Developer product wich is instant and not permanent. Usually used for ingame currency. (http://wiki.roblox.com/index.php/Developer_product)
I found this gamepass script wich promisses to do something after purchase.I don't know if it works.
01 | local passId = 0000 --change this to your GamePass Id |
02 | local marketplaceService = game:GetService( "MarketplaceService" ) |
03 |
04 | marketplaceService.PromptPurchaseFinished:connect( function (player,assetId,isPurchased) |
05 | if isPurchased then --if the player did pay |
06 | if assetId = = passId then --if what they bought is the pass |
07 | print (player.Name .. " bought the pass (" .. passId .. ")" ) |
08 | end |
09 | end |
10 | end ) |
--script from http://wiki.roblox.com/index.php?title=Game_pass#Giving_the_Game_Pass_an_effect