So i made a Timer for my new vibe game but now if i use it it will always put a , after the seconds cause the song is longer then only one second and it will print this:
What is actually needs to say is 02:34
And this is my script that i made to make the timer work
Also if you don’t know what the local Sec, Min and ID is that are Values the ID is the id if the song so if the ID changed then the timer will be set to the next song time.
local Sec = script.Parent.Sec.Value
local Min = script.Parent.Min.Value
local TimeLenght = game.Workspace.Music.Sound.TimeLength
local ID = game.Workspace.Music.Sound.ID
Sec = TimeLenght
repeat
Sec -= 60
Min += 1
until Sec < 60
if Sec < 10 then
script.Parent.Text = "0"..Min..":".."0"..Sec
else
script.Parent.Text = "0"..Min..":"..Sec
end
ID.Changed:Connect(function()
Sec = 0
Min = 0
wait()
Sec = TimeLenght
repeat
Sec -= 60
Min += 1
until Sec < 60
if Sec < 10 then
script.Parent.Text = "0"..Min..":".."0"..Sec
else
script.Parent.Text = "0"..Min..":"..Sec
end
end)
Also this is not a timer that moves it just need to say how long the song will be
From what I’m assuming, all of your variables are NumberValues or Numbers of some sort
Just change the Sec variable to a IntValue then I believe you should be all set, or you could also use the math.round() function to convert it that way
I can try that but idk where to put it cause also every song has an other value of time so the 02:34.728 will never work cause every song has an other value
You’re equaling the value to that, why though? It’d just result as returning back decimals
Could you try this?
local Sec = script.Parent.Sec.Value
local Min = script.Parent.Min.Value
local TimeLenght = game.Workspace.Music.Sound.TimeLength
local ID = game.Workspace.Music.Sound.ID
Sec = math.round(TimeLenght)
repeat
Sec -= 60
Min += 1
until Sec < 60
if Sec < 10 then
script.Parent.Text = "0"..Min..":".."0"..Sec
else
script.Parent.Text = "0"..Min..":"..Sec
end
ID.Changed:Connect(function()
Sec = 0
Min = 0
wait()
Sec = math.round(TimeLenght)
repeat
Sec -= 60
Min += 1
until Sec < 60
if Sec < 10 then
script.Parent.Text = "0"..Min..":".."0"..Sec
else
script.Parent.Text = "0"..Min..":"..Sec
end
end)
Ye i can but then it will not go down with the second so then it will be 10000 minutes so i don’t think that will work i think it’s something with the < and not the sec -= 60
But it is weird cause sometimes it does work
Idk why but it only works in roblox studio now that i see and i published it multiple times and i did shutdown the server
Also if you wanna test it you can here then you can see it doesn’t work: Game