How can I change the timer format from seconds to minutes?

fyi: %02i or %02d (both are the same) specifies how many digits at minimum should the given number have.

string.format("%02i", 5) -- 05 notice how it added a 0, thats the main point of this
string.format("%02i", 28) -- 28
string.format("%02i", 199) -- 199

string.format("%06d", 1024) -- 001024
1 Like

Yeah I’m sorry but, I don’t really have a solution to your issue right now, I’ll reply again if I find one.

It’s ok! I’ll try to find one myself too.

1 Like

Thank you, I appreciate you tell me this. :grinning_face_with_smiling_eyes:

If you don’t mind can you put the whole updated script and I will have a look. Thank you.

This problem has a very simple solution!

A minute = 60 seconds
So that means seconds divied by 60 is the amount of minutes and seconds.

You can also do:
Minutes = mins * 60
(example (5 minutes): 5 * 60

Yeah I believe we have a solution but I’m not sure if they are applying it correctly to their script. If we could have a look at the current script we could easily make the changes necessary.

I did some variables for minutes and seconds like you said and changed ā€œā€¦ i ā€¦ā€ to ā€œminutes : secondsā€ but it would give me an error saying: ServerScriptService.Round:30: attempt to index number with ā€˜seconds’

local roundlength = 300
local intermissionlength = 0
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local Camera = workspace.CurrentCamera

minutes = 5 * 60
seconds = minutes % 60

local function Teleport(Location)
	if not workspace.Spawns:FindFirstChild(Location) then return end
	for _, player in pairs(game.Players:GetPlayers()) do
		local char = player.Character or player.CharacterAdded:wait()
		char.HumanoidRootPart.CFrame = workspace.Spawns[Location].CFrame
	end
end

InRound.Changed:Connect(function()
	if InRound.Value == false then 
		Teleport("LobbyTP")
	end
end)
local function roundTimer(Time)
	while wait() do
		local minutes = math.floor(Time / 60)
		local seconds = math.floor(Time % 60)
		for i = intermissionlength, 0, -1 do
			InRound.Value = false
			wait(1)
			Status.Value = "TIME: "minutes : seconds""
		end
		for i = roundlength, 0, -1 do
			InRound.Value = true
			wait(1)
			Status.Value = "TIME: "minutes : seconds""
			if i <= 0 then
				Ended()
			end
		end
	end
end
spawn(roundTimer)
function Ended()
	for _, player in pairs(game.Players:GetPlayers()) do
		pcall(function()
			player.PlayerGui.EndGui.CameraHandler.Disabled = false
			task.delay(5,function()
				player.PlayerGui.EndGui.CameraHandler.Disabled = true
			end)
		end)
	end
	game.Workspace.Enemies:ClearAllChildren()
	game.Workspace.Pickups:ClearAllChildren()
end