Hello! I am trying to figure out how when you press “cancel” on a Developer Product, it will turn off the Loading GUI. I already have it where when you purchase it, but I am wondering how I can do it for when they press cancel.
This is the code:
local MPService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer or Players.PlayerAdded:Wait()
local StarterGui = script.Parent.Parent.Parent.Parent.Parent.Parent
local ProductId = 1212046063 --change to developer product id
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(Player, ProductId)
StarterGui.LoadingPurchase.Enabled = true -- right here is where it enables when they click it, but if they press cancel, I want it to disable the Loading like when you purchase
end)
MPService.PromptProductPurchaseFinished:Connect(function(UserId, ProductId, IsPurchased)
if IsPurchased then
StarterGui.RobuxShopMenu.Enabled = false
StarterGui.ThankYouMessage.Frame.Visible = true
wait(0.4)
StarterGui.LoadingPurchase.Enabled = false
end
end)
Thanks! Any help will be appreciated!