I am currently trying to mess with my music player and make it tell you the progress of the current song playing, however this does not seem to work. The only error I am getting is the hoursprogress is nil, which is most likely why it is not working but I’m sure theres other errors here that I would get if it wasn’t nil.
I also don’t think my rounding is correct.
Any help is appreciated.
while true do
wait(0.1)
local unroundedhoursprogress = workspace:WaitForChild("MusicPlayer").TimePosition / 3600
local unroundedhoursfinish = workspace:WaitForChild("MusicPlayer").TimeLength / 3600
local hoursprogress = round(unroundedhoursprogress)
local hoursfinish = round(unroundedhoursfinish)
local unroundedminutesprogress = hoursprogress - unroundedhoursprogress * 60
local unroundedminutesfinish = hoursfinish - unroundedhoursfinish * 60
local minutesprogress = round(unroundedhoursprogress)
local minutesfinish = round(unroundedhoursfinish)
local unroundedsecondsprogress = minutesprogress - unroundedminutesprogress * 60
local unroundedsecondsfinish = minutesfinish - unroundedminutesfinish * 60
local secondsprogress = round(unroundedsecondsprogress)
local secondsfinish = round(unroundedsecondsfinish)
script.Parent.Text = tostring(minutesprogress)..":".. tostring(secondsprogress) "/".. tostring(minutesfinish)..":".. tostring(secondsfinish)
end
function round(num)
return math.floor(num + 0.5)
end