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

how to change time countdown in seconds to use minute countdown instead?

hi there, I am trying to change the seconds of timing in my game to turn it to use minute instead. currently it look like this.

here is the code

local GameLength = 300

while true do

for i = GameLength, 0, -1 do 
Status.Value = "There are "..i.." seconds remaining"
wait(1)
end

end

now my question is how to turn it to use minutes instead of second. like this screenshot.

any help would be appreciated. thanks

1 answer

✓ Accepted answer

Simply calculate the minutes and seconds using the current time (i) with

local minutes = math.floor(i / 60)
local seconds = i - (minutes * 60)

math.floor returns the number rounded down to the nearest integer

Revised Server Script

local GameLength = 300

while true do
	for i = GameLength, 0, -1 do
		local minutes = math.floor(i / 60)
		local seconds = i - (minutes * 60)
		Status.Value = (minutes..":"..seconds)
		wait(1)
	end
end

1 comment

0

it works. thanks then

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