of     1   

xiaoxiao181
#155793468Thursday, February 12, 2015 3:11 AM GMT

local MarketplaceService = game:GetService("MarketplaceService") local productId = 21630313 script.Parent.MouseButton1Click:connect(function() MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, productId) end) It's a basic function to prompt the player when they click on the button to purchase a developer's product. I've been fiddling with the RemoteEvent in other projects but I still don't fully understand how it works. All I know for sure is that it allows client/server communication even when the filter is on. What I don't fully understand are the arguments. RemoteEvent.OnClientEvent:connect(function() MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, productId) end) Ok, so if I want to allow players to purchase map packs for my tower defense game, they simply select the map pack to purchase, which is in a server script in the workspace. The event above fires in a different script in the script service. So how does the OnClientEvent know which product ID they're going for? Is it as simple as this?: script.Parent.MouseButton1Click:connect(function() game.ReplicatedStorage.PurchaseEvent:FireClient(player, productId) end)
xiaoxiao181
#155798570Thursday, February 12, 2015 4:31 AM GMT

bump
xiaoxiao181
#155812515Thursday, February 12, 2015 3:29 PM GMT

I just realized I was wrong about where everything is coming from. It's a billboard gui in workspace with a server script, and the server script in script service to process the receipt. So I THINK I would have to send it to a local script using FireClient and then back to the server script using FireServer. Unless I've been wrong this entire time and both LocalScript and Script can handle purchase prompts. The wiki didn't say anything specific on which script had to be used, so I just assumed it was LocalScript.
xiaoxiao181
#155812641Thursday, February 12, 2015 3:34 PM GMT

Yup. server scripts can handle product purchases. That's nice to know. im an idiot. Forget this thred ever existed.

    of     1