Hello! Again another problem. Lets just dive in
I have a function in a timer modulescript called timer:Play() Here's the problem.
It works fine if it was no minutes and just seconds but problem is that when you put min and second once the seconds reach 0 then for a example like 2:05 after 5 seconds it just goes 1:59 and just freezes there I tried making the sec variable into i but the same result. Here is the code if you didn't know self is a variable created by a modulescript when you set a metatable onto the module table inside the table is
--sec and min is a parameter in timer.new
local table = {
started = false;
finished = false;
stopsignal = false;
min = minutes;
sec = seconds
}
Anyways lets get onto the code
self.started = true
local min = self.min
local sec = self.sec
for i = sec,0,-1 do
sec = sec - 1
for _,player in pairs(game.Players:GetPlayers()) do
player.PlayerGui.Timer.Enabled = true
if sec > 10 then
player.PlayerGui.Timer.Time.Text = min .. ":" .. sec
else
player.PlayerGui.Timer.Time.Text = min .. ":0" .. sec
end
if (sec <= 0 and min >= 0) then
min = min - 1
sec = sec + 60 --i think something is wrong here
end
if min < 0 then
self.finished = true
player.PlayerGui.Timer.Time.Text = 0 .. ":" .. "00"
print("Done")
break
end
end
Sadly no errors so i couldn't solve this myself Here is the script code
local thing = require(game.ReplicatedStorage:WaitForChild("Timermodule"))
local stuff = thing.new(0,59)
script.Parent.MouseClick:Connect(function()
stuff:Play()
end)

2 comments
Yeah it did have some errors so i fixed it and got it working! It still does do the pause at 59 thing though
I posted small edit, maybe that can help fix it? If not i am just going to post method that i am sure will work but will have bit different loop although i do not like to change the scripting tactics of someone but i guess i maybe should.