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) |