Hello!
I have this slider which works fairly well but I am a little bit stuck on how I would handle the value which would be the progress of the slider.
This first part controls the position of the slider:
currentConnections[#currentConnections + 1] = mouse.Move:Connect(function()
local y = mouse.Y
local topBoundary = 0
local bottomBoundary = sliderBounds.AbsoluteSize.Y
local mousePos = y - sliderBounds.AbsolutePosition.Y
local scaledPosition = math.clamp(mousePos, topBoundary, bottomBoundary) / bottomBoundary
notch.Position = UDim2.new(
notch.Position.X.Scale,
notch.Position.Y.Scale,
scaledPosition,
0
)
end)
Now, the problem I am facing is that I don’t know how I would scale the position up relatively to the lower and upper bounds of the value.
If the minimum value is -10 and the maximum value is 10, how would I go about scaling it up proportionately to this value?
If the notch’s Y position is 1/3 of the whole slider, what formula could I use so the returned value is 1/3 of the position between -10 and 10 if that makes sense?