-
17:13:30.896 Workspace.Kingdom.GreeterArea.AwardSessionBoards.AwardsBoard.Awards:21: attempt to compare number < function - Server - Awards:21
-
Ive tried youtube videos here and devforum and everywhere pls help!!
local sessions = {
{start = "10:00 AM", duration = 60},
{start = "12:00 PM", duration = 60},
{start = "2:00 PM", duration = 60},
{start = "4:00 PM", duration = 60},
{start = "6:00 PM", duration = 60},
{start = "8:00 PM", duration = 60},
{start = "10:00 PM", duration = 60},
}
function getTimeRemaining(session)
local startTime = session.start
local duration = session.duration
local now = os.time
local startHour, startMin = startTime:match("(%d+):(%d+)")
local startSeconds = tonumber(startHour) * 3600 + tonumber(startMin) * 60
local startDate = os.time({ year = os.date("%Y"), month = os.date("%m"), day = os.date("%d"), hour = 0, min = 0, sec = 0 })
startSeconds = startSeconds + startDate
if startSeconds < 3600 then
startSeconds = startSeconds + (24 * 3600)
end
local timeRemaining = startSeconds - now + (duration * 60)
return timeRemaining
end
while true do
for i, session in ipairs(sessions) do
local timeRemaining = getTimeRemaining(session)
if timeRemaining <= 0 then
timeRemaining = 0
end
local hours = math.floor(timeRemaining / 3600)
local minutes = math.floor((timeRemaining - (hours * 3600)) / 60)
local seconds = math.floor(timeRemaining - (hours * 3600) - (minutes * 60))
local SurfaceGui = script.Parent.AwardSessionTimes
if SurfaceGui then
local TextLabel = SurfaceGui.SessionTimes
if TextLabel then
TextLabel.Text = string.format("%02d:%02d:%02d"..hours ..minutes..seconds)
end
end
end
wait(1)
end
*Pls help me Im trying to make an award session board that shows how long till each award session if that make sense and it isnt working.
Ty in advance.