I am trying to make a timer that counts down from 60. This script works perfectly but apparently it crowds up my script too much. Is there a shorter form of this timer?
local msg = Instance.new("Hint") msg.Parent = nil msg.Parent = game.Workspace msg.Text = "Intermission: 60" wait(1) msg.Text = "Intermission: 59" wait(1) msg.Text = "Intermission: 58" wait(1) msg.Text = "Intermission: 57" wait(1) msg.Text = "Intermission: 56" wait(1) msg.Text = "Intermission: 55" wait(1) msg.Text = "Intermission: 54" wait(1) msg.Text = "Intermission: 53" wait(1) msg.Text = "Intermission: 52" wait(1) msg.Text = "Intermission: 51" wait(1) msg.Text = "Intermission: 50" wait(1) msg.Text = "Intermission: 49" wait(1) msg.Text = "Intermission: 48" wait(1) msg.Text = "Intermission: 47" wait(1) msg.Text = "Intermission: 46" wait(1) msg.Text = "Intermission: 45" wait(1) msg.Text = "Intermission: 44" wait(1) msg.Text = "Intermission: 43" wait(1) msg.Text = "Intermission: 42" wait(1) msg.Text = "Intermission: 41" wait(1) msg.Text = "Intermission: 40" wait(1) msg.Text = "Intermission: 39" wait(1) msg.Text = "Intermission: 38" wait(1) msg.Text = "Intermission: 37" wait(1) msg.Text = "Intermission: 36" wait(1) msg.Text = "Intermission: 35" wait(1) msg.Text = "Intermission: 34" wait(1) msg.Text = "Intermission: 33" wait(1) msg.Text = "Intermission: 32" wait(1) msg.Text = "Intermission: 31" wait(1) msg.Text = "Intermission: 30" wait(1) msg.Text = "Intermission: 29" wait(1) msg.Text = "Intermission: 28" wait(1) msg.Text = "Intermission: 27" wait(1) msg.Text = "Intermission: 26" wait(1) msg.Text = "Intermission: 25" wait(1) msg.Text = "Intermission: 24" wait(1) msg.Text = "Intermission: 23" wait(1) msg.Text = "Intermission: 22" wait(1) msg.Text = "Intermission: 21" wait(1) msg.Text = "Intermission: 20" wait(1) msg.Text = "Intermission: 19" wait(1) msg.Text = "Intermission: 18" wait(1) msg.Text = "Intermission: 17" wait(1) msg.Text = "Intermission: 16" wait(1) msg.Text = "Intermission: 15" wait(1) msg.Text = "Intermission: 14" wait(1) msg.Text = "Intermission: 13" wait(1) msg.Text = "Intermission: 12" wait(1) msg.Text = "Intermission: 11" wait(1) msg.Text = "Intermission: 10" wait(1) msg.Text = "Intermission: 9" wait(1) msg.Text = "Intermission: 8" wait(1) msg.Text = "Intermission: 7" wait(1) msg.Text = "Intermission: 6" wait(1) msg.Text = "Intermission: 5" wait(1) msg.Text = "Intermission: 4" wait(1) msg.Text = "Intermission: 3" wait(1) msg.Text = "Intermission: 2" wait(1) msg.Text = "Intermission: 1" wait(1) msg.Text = "Intermission: 0" wait(1)
You can use a for loop to decrease the time efficiently. This script will probably work correctly but you may need to adjust it a little to make it work.
local msg = Instance.new("Hint") msg.Parent = nil msg.Parent = game.Workspace for i = 0, 60 do msg.Text = "Intermission: ".. 60 - i end
Your script is perfect! You only lack efficiency. Would you rather have a 125 line script or a 6 line script. Try out this script:
local msg = Instance.new("Hint") msg.Parent = game.Workspace for i = 0, 60 do msg.Text = "Intermission: ".. 60 - i wait(1) end
Well, your script should work perfectly fine. But efficiency-wise it suffers. To fix up your script then what you can do is use a For loop to go through all the numbers, this way then each time the for loop iterates, we can set the text to the current number(:
local msg = Instance.new("Hint",game.Workspace) for i = 60,0,-1 do --Start, end, increment msg.Text = "Intermission: "..tostring(i) --Use tostring so you can concatenate the 'i' value. end