At a new Donation the amount of Money is reset

Okay, I have a script that saves the amount of player money, it works fine when collecting daily rewards. But when the player donates, he resets the amount of money to 0 and adds to it as much as I told him to add in the script, but he the past money he just resets. Below will be scripted on Donate and save money. Help please)


1 Like
  1. Use code blocks.
  2. The second script is so insecure, you are letting the client choose what money data to save. Letting them save however much money they want.
1 Like

I believe the problem is that you do this :

Currency.Value = Currency.Value + 10000 -- // line 18

Try to do this instead and check if it works :

Currency.Value += 10000 -- // line 18

Both should really work.
For example;

local num = 1
num += 1    -- = 2
local newNum = 1
newNum = newNum + 1   -- = 2
1 Like

So the number is added, just the past value that the player received is reset, and its replacement is the value he received in the donation

Either way, that is the least of your concerns.
The 2nd image is a huge problem. Why are you letting the client set the value of their money? And secondly, why is it a remote function if it is not expected to return anything?

In any case, I would initially like to fix the problem with the donation, and with the preservation, I’ll deal with it myself

The problem with your currency system is that it runs on both the server and client. This is likely causing your issue. Can you show me the script that picks up the remote functions invoked in the SavePlayerData local script?

Yes, these scripts, are set and get.