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

wont prompt gamepass purchase 100% of the time?

Asked by 5 years ago
Edited 5 years ago

title says all, this is the code:

local PassId = 4835177
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local BloxyCola = ReplicatedStorage:WaitForChild("????? ???? ???")
local player = game.Players.LocalPlayer
local bloxy = workspace:WaitForChild("itemgiver1")
local debounce = false

bloxy.ClickDetector.MouseClick:Connect(function(player)
         if MarketplaceService:UserOwnsGamePassAsync(player.UserId, PassId) then --if they have the gamepass
        if not debounce then

        debounce = true 

        BloxyCola:Clone().Parent = player.Backpack
        bloxy.ClickDetector.MaxActivationDistance=0
        bloxy.Transparency=1
        for i = 60, 1, -1 do -- give it a 60 second cooldown and show the timer
            bloxy.BillboardGui.TextBox.Text = tostring(i)
            wait(1)
       end

        bloxy.ClickDetector.MaxActivationDistance=10
        bloxy.BillboardGui.TextBox.Text=(" ") --replaces text and resets everything back to normal
        bloxy.Transparency = 0

        debounce = false -- allow the script to be run again
end
        else
 MarketplaceService:PromptGamePassPurchase(player, PassId)




    end
end)


most of the time the purchase of the gamepass doesnt come up, and when it doesnt the picture of the gamepass is white

this is the one line thats probably wrong:

MarketplaceService:PromptGamePassPurchase(player, PassId)

Answer this question