1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 25 Sep 2012 03:13 PM |
| Occasionally, when changing a value through multiple scripts, if the time in which the value is changed is close enough together, it doesn't change at all. So say you gain a small amount of money, but lose a large amount, nothing is lost because it happened at practically the same time. Is there any way around this, or any way to fix this? |
|
|
| Report Abuse |
|
|
|
| 25 Sep 2012 03:15 PM |
| use _G for calculating values and then update the value? |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 25 Sep 2012 03:17 PM |
| Is it only a problem when changing the value of something? If using shared would solve it, I would just remove the IntValue until I needed to do something locally. |
|
|
| Report Abuse |
|
|
|
| 25 Sep 2012 03:20 PM |
| ah yeah, nevermind what i said unless your managing points through a local script and were using the IntValue to share the points information with the server. |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 25 Sep 2012 03:48 PM |
| I figured I could just queue every change in any value through a single script. Now that I'm using locals, I can't use globals, so I send a value containing information into the game's main script and it reads and changes it from there. |
|
|
| Report Abuse |
|
|
|
| 25 Sep 2012 04:29 PM |
| Make a function attached to the value that will wait for any changes currently being made until it allows that script to change it, so basically like an update manager. |
|
|
| Report Abuse |
|
|
Parthax
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 6941 |
|
|
| 25 Sep 2012 09:33 PM |
Have an Boolean that the adding and subtracting will wait for before changing the int. Then right before it changes the value of the int, set the Boolean to the opposite of what it needs to wait for, then add a wait() and change the bool back.
It hurt my head typing that >.< |
|
|
| Report Abuse |
|
|