How do i check if a value is going up or down?

  1. What do you want to achieve?
    Hello, i have a temperature value and a text label. And i want to do if the temperature goes up the text label says “rising” and if goes down says “cooling” and if the value don’t change it says “stable”

  2. What is the issue?
    I don’t know how to do it.

  3. What solutions have you tried so far?
    I tried to do it myself but it didn’t work and i tried to look on devforum and others but i found nothing.

You can easily do this via changing it when you are setting the value, you will know if you are adding or subtracting from the value.

I tried that but my way to do it didn’t work

You can do it using an event on the value trough a local script inside the gui, and when it triggers just check the old value and compare it with the new one and base the text on that.
it would be:
:GetPropertyChangedSignal(“Value”) on the instance value

Show me the code then please otherwise I cannot help you.
Otherwise, you can use the .Changed event.

I don’t have the code anymore it was a long ago and now i need the system again

Ok, i will try that method, thanks

Okay i managed to check if the value goes up or down but how do i check if the value don’t change ?

Check the condition that makes the value go up or down and if none of them are true then you can make it say stable.

getpropertychangedsignal should have a parameter which is the old value so just work it out like this:

if OldValue > Temperature.Value then
    TemperatureLabel.Text = "Lowering"
else
    TemperatureLabel.Text = "Rising"
end
2 Likes

Yes great idea thank you guys for your help