Help with Slider Math

Im trying to make a slider from a certain song time position to another
Example: from 16 to 26

I need help with the math to convert it to 0 to 1
16 would be 0 and 26 would be 1

and also need help making the current song time position a number between 0 and 1

just do current/max it should range form 0 to 1

I tried that, but I need the number to be from a specific time position
it would only work if the starting time was 0

just subtract the certain time and add it back when applied

local min, max = 16, 26

for i = 0, 1, 0.1 do
   print(min + (i * (max-min)))
end

its the same thing as doing current/max

this is example of how you could do it

local StartPos = 16
local CurrentTime = 20 - StartPos
local MaxTime = 26 - StartPos

local NewPos = CurrentTime / MaxTime

print(NewPos)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.