I am trying to make it so when they click the purchase button, it will add the specified amount,
local Amount = player.PlayerGui.CurrencyGui.CashFrame.Amount.Value To there Cash when they purchase it.
This is what I tried.
Amount = Amount+Cash
However I don't know what's wrong with it. Is there a better method to do this?
local cash = script.Parent.Cash.Value
local buyButton = script.Parent
local productId = 0
local player = game.Players.LocalPlayer
local Amount = player.PlayerGui.CurrencyGui.CashFrame.Amount.Value
buyButton.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
Amount = Amount+Cash
end)
I tried doing the full path instead right here on line 11. Wouldn't that work?
local buyButton = script.Parent
local productId = 0
local player = game.Players.LocalPlayer
buyButton.MouseButton1Click:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
player.PlayerGui.CurrencyGui.CashFrame.Amount.Value = player.PlayerGui.CurrencyGui.CashFrame.Amount.Value + script.Parent.Cash.Value
end)
