While Loop Broken

I am making a timer with this script:

while wait(1) do
 local timeVal = script.Parent.Parent.Buy.TimeToOwn.Value
 timeVal = timeVal - 1
script.Parent.Parent.timeLeft.ui.lbl.Text = convert(timeVal)
if timeVal == 0 then
 script.Parent.Parent.timeLeft.ui.lbl.Text = 'Time Up!'

And yet it will only do it once and not repeat until it is finished.

It seems like you forgot an end at the back.

Oh i forgot to add that to the forum but its there

is timeVal supposed to counting down? If so, then the problem is that you’re setting the value of timeVal to whatever the value in TimeToOwn is at the start of each loop, which you aren’t changing anywhere in this loop. So unless you are reducing TimeToOwn by 1 every second in another script somewhere, timeVal will always be the same value every loop.

Oh yeah, thats the problem, thanks

Should have noticed that smh