here is my script its a local script (local seconds = script.Parent.Parent.Time script.Parent.Text = seconds.Value for i = 1,seconds.Value do wait(1) seconds.Value = seconds.Value - 1 script.Parent.Text = seconds.Value end )
Format your code using the blue lua button when writing it on this forum :)
It makes this much easier to read so we can help you!
i agree with the other guy, please format the code so that it isnt confusing. Anyways heres the script:
while wait() do wait(0.1) if seconds.Value == 0 then wait(1) seconds.Value = --Put the number you want here end end
lets say you want to make a timer, make a variable first
local Timer = 60 -- you can make it anything
now you want to do the actual script that does the timer
while Timer > 0 do -- checks if the timer is higher than zero, if it is it does this loop Timer = Timer - 1 -- reduces the timer wait(1) -- waits 1 second before doing the loop again script.Parent.Parent.Time = Timer -- sets the text label to the timer end -- ends the code block if Timer == 0 then -- if the timer is 0 it does the following Timer = 60 -- resets the timer end -- ends the code block
and we are done! if this helped please give me an upvote!
heres a simple timer script, i will place notes throughout the script so you understand what I'm doing
-- this is a note (actually it called a comment but whatever)
Code:
timer = 60 -- this is a one minute timer (since 60 seconds is one minute) while true do -- infinite loop timer -= 1 -- timer = timer - 1 but shorter if timer == 0 then -- if the timer reaches 0 break -- stop the loop timer = 60 -- timer becomes back to 60 end wait(1) -- make the infinite loop repeat every 1 second (without the wait, you will just make a lag spike lol) end