In this video I was trying to make a GUI slider for my admin panel and I’m trying to understand the code but I don’t get how the math in this would result in a neat slider.
I understand distance = targetPosition - originPosition but I don’t understand this:
local output = (mouse.X - frame.AbsolutePosition.X)/frame.AbsoluteSize.X
Why would the AbsoluteSize of the frame be divided by the X of the AbsoluteSize?
The more the Mouse moves to the left of the frame it, it will be zero because if mouse.X does somewhat equal to AbsolutePosition.X (that is because the AbsolutePosition.X starts at the left of the frame) it will be 0 and 0 divided by X is 0. If the mouse to the right more it increases its value to the right it is slowly closer equal to AbsolutePosition.X + AbsoluteSize.X. So the Outcome will be 1