So I have my code here.
db_value.Value = db repeat wait(1) db_value = db_value -1 print(db_value) until db_value == 0 --> This is supposed to loop it until the value reaches 0, right? end
This code just loops infinitely even though my goal is to stop it once it reaches 0, how can I fix this?
I already fixed this problem when answering your last question, but I don't mind answering again.
You're forgetting to include .Value
after the db_value
variable on line 3
and line 5
.
db_value.Value = db repeat wait(1) db_value.Value = db_value.Value -1 print(db_value.Value) until db_value.Value <= 0 end
you can do this;
db_value.Value = db repeat wait(1) if db_value ~= 0 then db_value = db_value -1 print(db_value) end until db_value == 0 --> This is supposed to loop it until the value reaches 0, right? end
Instead of using repeat, I'd do this:
while db_value > 0 do db_value = db_value -1 print(db_value) end