because i am hilariously bad at math, i really need to make this topic

essentially, i’m trying to make a timer (random between 90 seconds and 180 seconds), then convert that into minutes (to display it on the player’s GUI) and countdown to zero

thing is, i uh, i’m doing horribly

i hate mathematics (i have no idea what i’m doing)

local seconds = math.random(90,180)
print("Seconds selected: " .. seconds)
local minutes = math.floor(seconds/60)
local timer = math.floor(seconds%60)
print(timer)

To convert seconds to x:xx format, you can use this function

local function convert(seconds)
local cseconds = seconds % 60
if cseconds < 10 then
-- We don't want stuff like 0:3 or 1:1. We want it like 0:03 and 1:01 right?
-- Let's add a 0 before the single digit number.
-- 3 becomes 03, 1 becomes 01
cseconds = "0"..cseconds
end
-- This is how many minutes
local cminutes = math.floor( seconds / 60 )
-- Returns x:xx
return cminutes..":"..cseconds
end
print(convert(90)) -- outputs 1:30