How would I see how long left the song has until its done & how long it is.
Example:
Time Left: 2 Minutes & 12 seconds
Song Duration: 2 Minutes & 30 seconds
How would I see how long left the song has until its done & how long it is.
Example:
Time Left: 2 Minutes & 12 seconds
Song Duration: 2 Minutes & 30 seconds
You can check how much time left by
print(math.floor(sound.TimeLength - sound.TimePosition)) --this will only return seconds
You can check the song duration by
print(math.floor(sound.TimeLength)) --this will only return seconds
However these only return seconds if you want it to return minutes and seconds you will need to do some dividing.
Adding onto @Dolphin_Worms, you can put that value through the function below to get it in HH:MM:SS format.
function Format(Int)
return string.format("%02i", Int)
end
function convertToHMS(Seconds)
local Minutes = (Seconds - Seconds%60)/60
Seconds = Seconds - Minutes*60
local Hours = (Minutes - Minutes%60)/60
Minutes = Minutes - Hours*60
return Format(Hours)..":"..Format(Minutes)..":"..Format(Seconds)
end