What is the best way to tell if a value has been subtracted from?
I have some ideas like this one, for instance:
local number = game.Workspace.Number local prevnumber = number.Value number.Changed:connect(function() if number.Value < prevnumber then print("Number is smaller than prevnumber") end end)
But what I really want to know is if there is any other more efficient way to tell if a value has ben subtracted from.
Any help is greatly appreciated!
There is genuinely no better way to tell if it has been subtracted from than to check. Mind, your example code is wrong.
local num = workspace.Number; local prev = num.Value; num.Changed:connect(function(val) if prev > val then -- Subtracted from end prev = val; -- Make sure that you update the old value end);