I have made a timer admin command, it is suppose to copy the timer gui to the playergui (for all players) then countdown the timer that was giving to it through the chat. The gui part works fine however the countdown does not work and it starts at 0 instead of the timer value.
commands.timer = function(sender, arguments) local Timer = arguments[1] print(Timer) if Timer then for p, v in pairs(game.Players:GetChildren()) do local timerc = RS.Timer:Clone() timerc.Parent = v.PlayerGui for i = Timer, 0, -1 do timerc.Outer.Inner.TextLabel.Text = i end end end end
commands.timer = function(sender, arguments) local Timer = arguments[1] print(Timer) if Timer then for p, v in pairs(game.Players:GetChildren()) do local timerc = RS.Timer:Clone() timerc.Parent = v.PlayerGui for i = 0, Timer, -1 do timerc.Outer.Inner.TextLabel.Text = i end end end end
pretty certain thats all. Last time I checked it was that the first number was the minimum and the second was the max and the third was in what direction it goes in. like this:
min = 1 max = 10 direction = 1 for i = min, max, direction do print(i) end -- Should print: 1 2 3 4 5 6 7 8 9 10
Because you had -1 as the direction it's clear you want it going down. But in the order you originally had you'd have to change the -1 to a 1 to make it go up.
Because you had "Timer" at the start, it thinks that's the min and the 0 is the max, so it starts at 0 and ends at 0 because of the way you're doing it. Hopefully this helped