i want to make a gui where when you’re purchasing something (like a press a button it prompts me to buy a gamepass or something) when im in the prompt menu it will have a gui in the background with some spinning circle
then when i buy the product it says purchase successful or when i dont buy it it will say purchase failed
idk how to make this but im assuming i need to use a remote event but i literally have no idea how to make this can somebody help me?
Have a LocalScript in a gui that handles all these effects + a remote event (from ServerScript-to-LocalScript) and a bindable event (from LocalScript-to-LocalScript) both to call the startSpinningCircle() function.
local startSpinningCircleBindableEvent
local startSpinningCircleRemoteEvent
local function stopSpinningCircle() -- Stops the spinning circle background screen
end
local function startSpinningCircle() -- Starts the spinning circle background screen
end
local function hidePurchaseSuccessful() -- Hides the purchase successful popup
end
local function showPurchaseSuccessful() -- Shows the purchase successful popup
end
local function hidePurchaseFailed() -- Hides the purchase failed popup
end
local function showPurchaseFailed() -- Shows the purchase failed popup
end
local function robuxProductPromptFinished(player: player, robuxProductId: number, wasPurchased: boolean) -- This function handles what happens after a dev product or game pass prompt has finished
stopSpinningCircle()
if wasPurchased then
showPurchaseFailed()
else
showPurchaseSuccessful()
end
end
-- These will get fired by a different LocalScript or ServerScript before calling `MarketplaceService:PromptProductPurchase()` or `MarketplaceService:PromptGamePassPurchase()` in order to start the spinning circle background screen
-- Note: Do this on the client (using the bindable event) for better response time
startSpinningCircleRemoteEvent.OnClientEvent:Connect(startSpinningCircle)
startSpinningCircleBindableEvent.Event:Connect(startSpinningCircle)
-- These will get fired after we press "OK" on the screen that shows up after a robux product purchase/fail popup
-- Note: They will still get fired even if the server initiates the prompt (only if the server prompted it for our player)
MarketplaceService.PromptProductPurchaseFinished:Connect(robuxProductPromptFinished)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(robuxProductPromptFinished)