I'm puzzled. I want it to clone the GUI for each player, and whatnot. It works, but it clones it a bunch of times, and they dont count-down the whole time I put in. Can someone tell me why?
print("enter")
function countdown(length)
for k,p in pairs (game.Players:GetPlayers()) do
local h=p.PlayerGui.TimerGui.Frame.TextLabel
for i = length,1,-1 do
h.Text = tostring(i)
end
end
end
print("entrrhdher")
debounce=false
while true do
wait()
for k,plr in pairs(game.Players:GetPlayers()) do
if plr.Name=="Obscuriti" or plr.Name=="MathisGuidonsio" or plr.Name=="Tempestatem" or plr.Name=="ImperatorVince" then
plr.Chatted:connect(function(msg)
if msg:sub(1,7) == "/timer " then
for k, p in pairs(game.Players:GetPlayers()) do
print("Cloning")
m=game.Lighting.TimerGui:Clone()
m.Parent=p.PlayerGui
end
local time = tonumber(msg:sub(8))
countdown(time)
for k, p in pairs(game.Players:GetPlayers()) do
p.PlayerGui.TimerGui:Destroy()
end
elseif msg:sub(1,9)== "/timerend" then
for k,p in pairs (game.Players:GetPlayers()) do
p.PlayerGui.TimerGui:Destroy()
end
end
end)
end
end
end
