Alright, I’m designing this time trial racing game and each checkpoint you pass grants you a time bonus.
The problem consists of adding the time to the timer itself. Since I’m using this format (0:00) to display time the seconds go over 60.
I’m trying to make it where if the seconds gained from the time bonus exceeds the max amount second (59) then it adds a minute and the seconds left over from the bonus.
Instead of having it as an IntValue, what if you have the 0:00 format as a StringValue?
Then with that you can set the variables for minutes, and seconds. Something like this:
local TimeFormat = string:split(StringValue.Value, ":")
TLogic = {}
function TLogic.timeGate(Sec)
local minutes = tonumber(TimeFormat[1])
local seconds = tonumber(TimeFormat[2]) += Sec
local leftOver = (Sec - 60)/2
if seconds >= 59 then
print(leftOver)
local addMinute = minutes + 1
local addSeconds = leftOver
end
print('Time Added - ' .. Sec .. ':' .. leftOver)
end
You can maneuver with this script to best fit your likings, might catch some errors…
Got two errors, one on line 20 “identifier expected error parsing the statement” and another stating "invalid argument #1 to ‘split’ (string expected, got table) "