In-Game Currency [Developer Products] Please Help?
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...
The Product works just fine. However, adding the RoCash does not. As you can see below, I want the player to receive 5 RoCash. When the product is purchased, it gives the player 20 RoCash... Why? How can I fix this?
Server-Side
01 | local Player = script.Parent.Parent.Parent.Parent.Parent.Parent |
03 | local MarketplaceService = Game:GetService( "MarketplaceService" ) |
05 | MarketplaceService.ProcessReceipt = function (receiptInfo) |
07 | Player.RoCash.Value = Player.RoCash.Value + 5 |
09 | Player.PlayerGui.Purchases.RoCash.Visible = true |
11 | Player.PlayerGui.Purchases.RoCash.Visible = false |
13 | return Enum.ProductPurchaseDecision.PurchaseGranted |
Client-Side
01 | local buyButton = script.Parent |
02 | local productId = 19192652 |
03 | local Player = script.Parent.Parent.Parent.Parent.Parent.Parent |
07 | if Player.Name = = "Bolohuc" then Type = 2 else Type = 0 end |
09 | buyButton.MouseButton 1 Click:connect( function () |
10 | Game:GetService( "MarketplaceService" ):PromptProductPurchase(game.Players.LocalPlayer, productId, false , Type) |
PLEASE ANSWER AS SOON AS POSSIBLE!
NOTE: I don't want you to change the script unless it's causing the problem... It works fine other than the adding RoCash. Please help me... Provide details with your answer please.