--edits the time of the int values so that the bullets know the time.
fullTime.Value = math.floor(((song.TimeLength*100)+0.5))/100
currTime.Value = math.floor(((song.TimePosition*100)+0.5))/100
This script is supposed to get the time value of a song and floor it to the hundredth, but it’s not working? What would be the issue?
Here, let me give you an example. The number I would usually get for time is something like this “1.4543793”. I would like to just get the first two decimal numbers.
What is the output you are getting? Is it just the same as the input?
Try splitting it up and see where the problem is.
such as
local temp = song.TimePosition
print temp
temp = temp * 100
print temp
temp = temp + .5
print temp
temp = math.floor(temp)
print temp
temp = temp / 100
print temp
local song = script.Song
song.Loaded:Wait() -- Wait for the song to finish loading
local length = song.TimeLength
local roundedLength = math.floor(length * 100 + 0.5) / 100
print("Rounded Length:", roundedLength)
module.RoundDec = function(value,precision,up)
precision = precision or 0
value = tonumber(value) or 0
value = value * math.pow(10,precision)
if up then
value = math.ceil(value)
else
value = math.floor(value)
end
value = value / math.pow(10,precision)
return tonumber(string.format("%."..precision.."f",value))
end
Let me clarify, let’s say I have a number 3.67828. You only want to get the first 2 decimal numbers, which is .67, without rounding it up or down. Is this correct?