Getting previous value from changed event

I am trying to get the previous value of the intvalue when detecting a change using IntValue.Changed:Connect()
How would I do this?

1 Like

If you want the previous value after it changes, you want to keep a global variable that is checking IntValue.Value. For every time it fires Changed, the function will do whatever on the new value and then setting the global variable to the new one before the function ends.

7 Likes

ok, i will try this right now.

Sorry to bump this thread. Just in case people are still looking at this post for advice please keep in mind that global variables are considered bad practice and are NOT recommended. Iā€™d advise finding another solution!

1 Like