Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's Wrong With My Product?

Asked by
sgsharp 265 Moderation Voter
10 years ago

In my game, I have made a currency called "RoCash." This currency will be used to purchase things in the game.

The Value of "RoCash" is inserted into the player each time they enter the game. A Data Persistence script automatically saves the state of the value each time it has changed. (I am not using DataStore for a reason...)

Okay, I have a Shop GUI, and in the GUI, there's a button that is supposed to add 5 RoCash to the player's RoCash value each time it's purchased...

However, it adds 20 instead of 5... How can I fix this, ans why is it happening?

Server-Side

local Player = script.Parent.Parent.Parent.Parent.Parent.Parent

local MarketplaceService = Game:GetService("MarketplaceService")

MarketplaceService.ProcessReceipt = function(receiptInfo)

    Player.RoCash.Value = Player.RoCash.Value + 5

    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

Client-Side

local buyButton = script.Parent
local productId = 19192652
local Player = script.Parent.Parent.Parent.Parent.Parent.Parent

Type = 0

if Player.Name == "Bolohuc" then Type = 2 else Type = 0 end

buyButton.MouseButton1Click:connect(function()
    Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId, false,  Type)
end)

PLEASE ANSWER AS SOON AS POSSIBLE!

Answer this question