Usually, almost every object has the .Changed event, so does variables in scripts have those? It would be very useful and easy to use
For example:
local var = true
-- if the value of the 'var' changes then a command will be triggered
Usually, almost every object has the .Changed event, so does variables in scripts have those? It would be very useful and easy to use
For example:
local var = true
-- if the value of the 'var' changes then a command will be triggered
Nope this is not possible. However you could do something like this
local last = varYouWantedToTrack;
while true do
wait()
if varYouWantedToTrack ~= last then
-- It changed. How nice.
end
last = varYouWantedToTrack;
end
end);
How about this?
local previous_var = true
local var_that_is_going_to_be_changed = true
local overlap_prevention = false
while wait() do
if previous_var ~= var_that_is_going_to_be_changed then
previous_var = var_that_is_going_to_be_changed -- set the new value
-- do stuff
end
end
That should work fine. Just seems unnecessarily complex ( not hard ) but code heavy if you do this multiple times.
I don't think you event need the overlap_prevention, because as soon as you set the previous_var's new value, the if statement becomes false
What do you mean it's unnecessarily complex casper? It is the same as yours only a little more compact.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
What about my idea? In the answers