I'm making a donate button which allows people to donate to me. I have everything setup but now I just need the script that actually allows people to make the transaction. This is how the setup goes game > starter GUI > screen GUI > Frame >text button > script.
Edit: Figured it out, here is the script:
MPS = game:GetService("MarketplaceService") id = 1138682487 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() MPS:PromptProductPurchase(player, id) end)
it better be a local script for it to work properly. You detect button press
script.Parent.MouseButton1Down
then you use a remote event, fire it
game.ReplicatedStorage.RemoteEvent:FireServer()
then set up a listener with a server script
game.ReplicatedStorage.RemoteEvent.OnServerEvent
then make the transaction work, and you can pass information over from client to server using parameters like what ur buying
game.ReplicatedStorage.RemoteEvent:FireServer("chocolate")
but remember, automatically the first parameter for the listener is the player who fired the event, so set up parameters like this
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, parameter1) if paremeter1 == "chocolate"...
I hope this is the answer you were looking for... if not, then i will help
***local id = 1138682487
script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromtProductPurchase(game.Players.LocalPlayer, id) end)
The script I currently have