Sorry if the title is confusing; I'll explain better here.
In the below code, the program is waiting 10 seconds, subtracting from an IntValue (hungerValue.Value), then checking that IntValue. If the value == 60, 40, or 20, it displays one of three messages from an array.
I also want have this hungerValue decrease when the player jumps, but the code only checks for the hungerValue.Value after every 'wait(10).' Meaning, the messages only appear if the hungerValue ticks down. If a player 'jumps' his/her hungerValue down to 60,40, or 20, the gui doesn't appear.
So, my underlying question is: how can I check those if statements at every moment, so that if the player 'jumps' his/her hungerValue down to 60, 40, or 20, the gui appears.
while wait(10) do
if hungerValue.Value - 1 >= 0 then
hungerValue.Value = hungerValue.Value - 1
end
if
hungerValue.Value == 60 then
HungerFrame.TextLabel.Text = hungerStrings[1]
HungerFrame.Visible = true
wait(5)
HungerFrame.Visible = false
end
if
hungerValue.Value == 40 then
HungerFrame.TextLabel.Text = hungerStrings[2]
HungerFrame.Visible = true
wait(5)
HungerFrame.Visible = false
end
if
hungerValue.Value == 20 then
HungerFrame.TextLabel.Text = hungerStrings[3]
HungerFrame.Visible = true
wait(5)
HungerFrame.Visible = false
end
Any help or hints in the right direction would be greatly appreciated!

4 comments
you can try connecting a event
You could used :Changed() to make if the string value of the player's hunger is an instance.
Changed isnt a function, its a event
can you show use the complete script?