I’m making this script so if you bought the developer product, then you get 100 of my currency, the remote event fires it to the currency. The serverscript of the remoteevent works but the localscript doesn’t
script:
local player = game.Players.LocalPlayer
local m = game:GetService("MarketplaceService")
local gamepassid = 3469098919
game:GetService("MarketplaceService").PromptPurchaseFinished:Connect(function(player, assetId, purchased)
if assetId == gamepassid then -- Replace 0000000 with your ID
if purchased then -- If did purchase it then..
game.ReplicatedStorage.BuyedBirdBux:FireServer(100)
end
end
end)
script.Parent.MouseButton1Click:Connect(function()
m:PromptProductPurchase(player, gamepassid)
end)
You need to do all of this through the server and use ProcessReciept. I would do something like this:
(I wrote this quickly)
Client:
local m = game:GetService("MarketplaceService")
local productId = 3469098919
script.Parent.MouseButton1Click:Connect(function()
m:PromptProductPurchase(player, productId)
end)
Server:
local MarketplaceService = game:GetService("MarketplaceService")
local productId = 3469098919
MarketplaceService.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == productId then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if player then
game.ReplicatedStorage.BuyedBirdBux:FireClient(player, 100)
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
You can only have one occurrence of ProcessReceipt in your game. Any additional ones will be ignored, so you need to use an if statement within the single occurance of ProcessReceipt to handle the different products