Hi! I want to display the number of minutes and seconds of a song in a text label but the problem is it displays the milliseconds as well. How do I not show them? Here's the script:

local musicScript = script.Parent.Parent.Parent.Parent.Parent.PlayerScripts.LocalMusic

while true do
	wait()
	
	if musicScript:FindFirstChild("PlayingSong") then
		local ms = musicScript:FindFirstChild("PlayingSong").TimePosition
		local timePos = math.floor(ms / 60)..":"..(ms % 60)
		print(timePos)
		script.Parent.Text = timePos.."|"..musicScript:FindFirstChild("PlayingSong").TimeLength
	else
		repeat wait() until
		musicScript:FindFirstChild("PlayingSong")
	end
end

2 comments

1

Use math.floor to round the number down ?

0

Yes, math.floor is epic.