Hi, I am working on a game and I want there to be a donate button in the GUI. Here is the script:
local productId = 978564492
local donateButton = game.StarterGui.DonateGUI.DonateButton
local function donate(player)
game:GetService("MarketplaceService"):PromptProductPurchase(player,productId)
game.StarterGui.DonateGUI.DonateButton.MouseButton1Click:Connect(donate)
end
This script is located in game.StarterGui.DonateGUI.DonateButton.DonateScript. It is a LocalScript. I do not get any errors in the output, but when test the game, I click the button and nothing happens.
Here is an image of where the script and button is located: https://photos.app.goo.gl/rUcJvQN71Y2RWa4t7
I would appreciate it if somebody could help. Thanks

1 comment
Thanks. I actually got it to work by replacing the last line with script.parent.MouseButton1Click:Connect(function() donate(game.Players.LocalPlayer) end) and replacing all instances of game.StarterGui.DonateGUI.DonateButton with script.parent