Why does my gamepass button prompt when i purchased it already?
Hello, Basically I have made a gamepass button within the gui and i test in server and when I press the button, it prompts and I purchase it, the problem is if I press it again it prompts again and doesnt give me my item . I have already check that it is the right gamepass id and have check if everything works fine. I believe it has to do with caching because a few minutes later it works. So is there a faster way to cache gamepass prompt and check if i have it?
Localscript in button:
01 | local GiveBoomBox = game:GetService( "ReplicatedStorage" ).Events:WaitForChild( "BoomBox" ) |
02 | BoomBox = game.Players.LocalPlayer.Backpack:FindFirstChild( "BoomBox" ) |
06 | if BoomBox = = game.Players.LocalPlayer.Backpack:FindFirstChild( "BoomBox" ) and game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(script.Parent.Parent.Parent.Parent.UserId, 5143841 ) then |
07 | print ( "Boombox was nil" ) |
08 | GiveBoomBox:FireServer() |
10 | print ( "Boombox fired" ) |
11 | elseif BoomBox ~ = game.Players.LocalPlayer.Backpack:FindFirstChild( "BoomBox" ) and game:GetService( "MarketplaceService" ):UserOwnsGamePassAsync(script.Parent.Parent.Parent.Parent.UserId, 5143841 ) then |
12 | print ( "Already Have it" ) |
14 | game:GetService( "MarketplaceService" ):PromptGamePassPurchase(game.Players.LocalPlayer, 5143841 ) |
17 | script.Parent.MouseButton 1 Down:connect(click) |
Script in ServerScriptService:
1 | game.ReplicatedStorage.Events.BoomBox.OnServerEvent:Connect( function (player) |
2 | local Boombox = game.ServerStorage:FindFirstChild( "BoomBox" ) |
3 | Boombox:Clone().Parent = player.Backpack |