So, im doing a script for a logic gate, that the player will be able to choose from delay and hold (i dont know if i will add more later). And the code is the following:
if FT == true then -- FT is the status of the input (true or false)
ACTIVE = true -- prevents plr from changing the timer mid activation
IN.BrickColor = BrickColor.new("Bright blue") -- changes INPUT color
--wait(TOTALTIME) -- error here!!
--note: TOTALTIME is in seconds, by multiplying minutes by 60
OUT.BrickColor = BrickColor.new("Bright blue")
status[INDEXOUT1] = true
else
ACTIVE = false -- lets the player change the timer again
IN.BrickColor = BrickColor.new("Black") -- changes back color
OUT.BrickColor = BrickColor.new("Black")
status[INDEXOUT1] = false
end
but everytime the script reads wait(TOTALTIME) it will stop everything and wait untill that is done i tried something else like:
while TIME > 0 do
wait(0.001)
TIME = TIME - 0.001
end
if TIME <= 0 then
TIMEOVER = true
else
TIMEOVER = false
end
but its not decreasing correctly, if there is no wait() it does it instantly. but if there is a wait() it does it super slowly, not on the correct time. I have no idea of how to fix this, if someone could help me i would appreciate it alot!

3 comments
im trying to use delay() to see if it works, still testing it tho
You really need to use wait() (or task.wait() rather) in a loop otherwise it will break your game.
Also can you please explain more of what you're trying to do? It's confusing for me..