this code is supposed to make my ui slider repeatedly go to the left, then right until you either cancel the swing or click mousebutton1.
all of that works fine, but I have a small problem, the slider travels to the top of the frame, instead of staying in a straight line. here is a video:
[RoTour - Roblox Studio (gyazo.com)]
(https://gyazo.com/3623b3c5841e80201c4861c363915ac7)
there’s no errors, and I thought it might be useful to say that the anchor point of the slider is 0,0.5 if that has anything to do with it.
here is the relevant code, ant there is another line of code that returns the slider to the center when you let go of the spacebar, which works fine.
local MaxLeftPos = UDim2.new(SliderUI.Slider.MaxLeft.Position.X,0,0,0)
local MaxRightPos = UDim2.new(SliderUI.Slider.MaxRight.Position.X,0,0,0)
local function SliderUpSwing()
-- start upswing
Slider:TweenPosition(UDim2.new(MaxLeftPos,0,0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear,0.5,true)
wait(0.5)
repeat
Slider:TweenPosition(MaxRightPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear,0.75)
wait(0.75)
Slider:TweenPosition(MaxLeftPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear,0.75)
wait(0.75)
until InSwing == false or swinging == true
end
any help is appreciated, thanks.