Hello, everyone!
I’m currently trying to fix my notification system, which will, on occasion, display the incorrect number of resources you gained or lost. I am not sure why this happens, but I’m certain it has to do with my algorithm.
To explain the problem better, if you have 100 wood, and you gain, say, 7 wood, it’s supposed to display as 7 wood. However, it will sometimes display as the player’s entire wood resource, which would be at this point, 107. And when taking away from the resource value, it will display as “-107” instead of “-7.”
Any help would be greatly appreciated!
Here is my algorithm for controlling the display text of the notification system.
local ChangedValue = NewValue - OldValue
OldValue = NewValue
notif.Amount.Text = ChangedValue
It should also be noted that “NewValue” is stored in a function variable, like this:
function(NewValue)
Another thing too, is if you lose resources, and then gain resources, it still displays it as a negative number, with how much wood you had before the gain. Same applies for when you lose resources, it flips it.