Loading icon while promptpurchase going on

Hey, im trying to achieve something where basically I have a shop GUI setup with buy buttons…
image

Everything works and is functional but I saw this effect in another game that caught my eye, basically when you click buy, a spinner icon pops up

ex:
image

and starts spinning.

If you click Purchase it goes away or if you click cancel it also goes away. its only visible for however long the gamepass purchase prompt is up on your screen for.

How can i achieve this?

Put the code to make it spin under the same function you use to prompt the purchase.

--DeveloperProduct example
local mps = game:GetService("MarketplaceService")

local function prompt()
    mps:PromptProductPurchase(player, ID_HERE)
    --code goes here to make it do the spinny thing
end

button.MouseButton1Click:Connect(prompt)

Then, use PromptProductPurchaseFinished to detect when it is finished, and reset the button.

local function resetButton(player, productId, purchased)
    if productId == ID_HERE then
        --reset button code here
    end
end

mps.PromptProductPurchaseFinished:Connect(resetButton)

MarketplaceService documentation:
MarketplaceService | Documentation - Roblox Creator Hub

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.