I am making a speedometer and when wait becomes inf (1/0) it counts as wait()
Is there any way to make the wait time just inf?
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "km/h" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 120 ,
spInc = 20 , -- Increment between labelled notches
}
}
local currentUnits = 1
local values = script.Parent.Parent.Parent.Values
while true do
wait(1/math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude))
script.Value.Value += 1
end
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "km/h" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 120 ,
spInc = 20 , -- Increment between labelled notches
}
}
local currentUnits = 1
local values = script.Parent.Parent.Parent.Values
while true do
wait(1/math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude))
task.wait()
repeat until math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) >= 0
script.Value.Value += 1
end
local currentUnits = 1
local values = script.Parent.Parent.Parent.Values
while true do
wait(1/math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude))
repeat task.wait() until 1/math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) ~= math.huge
script.Value.Value += 1
end
--Calculated by approximation(2^127*1.9999999) and then fine-tuned to the exact max
--Extra .999999...9 can be added, it's an approximation of ...664
local safeINF = 340282356779733642748073463979561713663
local t = math.huge
local chosen = math.min(t, safeINF)
task.wait(t)
print("1. Run")
task.wait(safeINF*1.000000000000001)
print("2. Run")
task.wait(chosen)
print("3. Doesn't Run")
Decided to leave it here for the lost souls trying to figure out the max value.