Just wondering if there was a way in shortening this script, while still keeping the Value's of the Size.
function Countdown() script.Parent.FontSize = "Size32" wait() script.Parent.FontSize = "Size28" wait() script.Parent.FontSize = "Size24" wait() script.Parent.FontSize = "Size18" wait() script.Parent.FontSize = "Size14" wait() script.Parent.FontSize = "Size12" wait() script.Parent.FontSize = "Size11" wait() script.Parent.FontSize = "Size12" wait() script.Parent.FontSize = "Size14" wait() script.Parent.FontSize = "Size18" wait() script.Parent.FontSize = "Size24" wait() script.Parent.FontSize = "Size28" wait() script.Parent.FontSize = "Size32" end
Create an array with the Sizes as indexes.
Then use a for loop to go through them.
--Create an array with your changes local sizes = {"Size32", "Size28", "Size24", "Size18", "Size14", "Size12", "Size11", "Size12", "Size14", "Size18", "Size24", "Size28", "Size32") --For loop that goes through array for x = 1, #sizes, 1 do wait() script.Parent.FontSize = sizes[x] --Assigns the index end
The for loop will only go through the amount of indexes it has than stop.
#sizes
is a cool way to return the length of an array.
Let me know if you have any other questions.
local function countdown() local sizes = {32,28,24,18,14,12,11} for i = 1,#sizes do script.Parent.FontSize = "Size"..sizes[i] wait() end for i = #sizes,1,-1 do script.Parent.FontSize = "Size"..sizes[i] wait() end end