What do you want to achieve?
A PromptPurchase from a TextButton inside of a SurfaceGui.
What is the issue?
It doesn’t seem to be working, I have tried fixing it myself but had no luck.
What solutions have you tried so far?
I have looked on the DevForum and YouTube and have found nothing.
Here is the script:
local productId = 1331518806
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)
local MarketplaceService = game:GetService("MarketplaceService")
local ID = 1331518806
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, ID)
end)
LocalScripts don’t work if they were originally parented to workspace. You would either have to move the SurfaceGui to StarterGui and change it’s Adornee property to the InstantPass.Screen part, or parent the LocalScript in recommendably StarterPlayerScripts and just reference the Buy button and detect it’s MouseButton1Click event.