I created a developer product system for my game, where there is a bank and you can buy all different products, and i did it with a remote event (necessary)
Everytime the player clicks the gui for any it fires the remote with the exact money you purchased and here is the server script
FOCUS ON LINE 22, and the local script i wrote in here is unecessary to read but i did it anyways
SERVER SCRIPT
local RemoteEvent = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("MarketPlaceRemote").RemoteEvent
local MarketPlaceService = game:GetService("MarketplaceService")
local function ProcessReceipt(receiptInfo, moneygiven)
local Player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not Player then
-- Player left the game
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if Player then
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + tonumber(moneygiven)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
RemoteEvent.OnServerEvent:Connect(function(player, moneygiven)
MarketPlaceService.ProcessReceipt = ProcessReceipt( [[-- Why can't i put the amount of coins that was sent to the thing?? --]] )
end)
LOCAL SCRIPT [You don't need to read this btw!]
-- i already prompted the player above here so yeah..
script.Parent.Parent.ShopFrame.Transaction1.ImageButton.Activated:Connect(function()
RemoteEvent:FireServer("200")
end)
script.Parent.Parent.ShopFrame.Transaction2.ImageButton.Activated:Connect(function()
RemoteEvent:FireServer("500")
end)
script.Parent.Parent.ShopFrame.Transaction3.ImageButton.Activated:Connect(function()
RemoteEvent:FireServer("2000")
end)
script.Parent.Parent.ShopFrame.Transaction4.ImageButton.Activated:Connect(function()
RemoteEvent:FireServer("10000")
end)

1 comment
Already did so :/