Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I fix this script so that it displays a number in minutes?

I have this script that makes a round that repeatedly teleports a player back and forth between the lobby and game area. Its been working so far but the roundLength is being displayed in seconds while I would want it to display in minutes. I have tried to turn it into increments of 60 so far but I haven't fixed it.

local roundLength = 1000
local intermissionLength = 60
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status

local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn


InRound.Changed:Connect(function()
	wait (1)
	if InRound.Value == true then
		for _, player in pairs(game.Players:GetChildren()) do
			local char = player.Character
			char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame
		end
	else
		for _, player in pairs(game.Players:GetChildren()) do
			local char = player.Character
			char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
		end
	end
end)



local function roundTimer()
	while wait() do
		for i = intermissionLength, 0, -1 do
			InRound.Value = false
			wait(1)
			Status.Value = "Intermission: ".. i .." seconds left!"
		end
		for i = roundLength, 0, -1 do
			InRound.Value = true
			wait(1)
			Status.Value = " ".. i .." seconds until Alpha Warhead detonation!"		
		end
	end
end

spawn(roundTime

r)

1 answer

If you wish to convert your interval concatenation to a digital format, you can use a format string to build the four digit foundation 00:00. By simultaneously applying the baseline modulo & division calculations to retrieve the minutes-to-seconds data, we can achieve the effect.

string.format("d:d", i/60, i%60))

EDIT:

StackEdit appears to be recognizing the formatting syntax that I've used to build the foundation. I've made a pastebin for you to get the authentic version of the snippet above.

This discussion is preserved as it was. New answers, comments, and votes are closed.