Hello! I’ve got 2 slider GUIs and they will both snap but they’ll both snap differently.
Below is my first slider GUI I’d like to snap. I’d like this to snap at each line (FOR, OFF, REV and ISOL) the code I currently have does work but it is not aligned properly and I’m horrible at math so I don’t know the correct way to get each point.
Here is the code for this part
local AbsolutePosition = DriveMode.Base.AbsolutePosition.Y
local AbsoluteSize = DriveMode.Base.AbsoluteSize.Y
local Number = math.clamp(math.floor((Y - AbsolutePosition) / AbsoluteSize / SNAPDISTANCE + 0.5) * SNAPDISTANCE, 0.159, 0.745)
DriveMode.Handle.Position = UDim2.new(0.586, 0, Number, 0)
For this one I did try to get the distance from FOR to ISOL and then divided it by 4 as the SNAPDISTANCE but that didn’t cut it and I’ve tried a few other ways and those also didn’t cut it.
And for my second slider GUI shown below I want it snap at every whatever the distance is between the MAXP and OFF or OFF and MINB line lets say this distance is 0.1 it’ll snap every 0.1 pixels? from MAXP to MAXB but from MAXB to EMERG it’ll just go straight from 1 to the other without snapping anywhere in between
Here is the code for this one
local AbsolutePosition = Throttle.Base.AbsolutePosition.Y
local AbsoluteSize = Throttle.Base.AbsoluteSize.Y
local Number = math.clamp(math.floor((Y - AbsolutePosition) / AbsoluteSize / SNAPDISTANCE + 0.5) * SNAPDISTANCE , 0.141, 0.913)
Throttle.Handle.Position = UDim2.new(0.542, 0, Number, 0)
For this one I tried to get the distance from MINP to OFF and then used that as the SNAPDISTANCE but that didn’t cut it and I’ve tried a few other ways and they also didn’t cut it.
Any help appreciated thanks!