MouseMoved() event stops working under specific conditions

I wrote some sliders for RGB color selection a few days ago, and I just moved their location in my UI, only to discover that they suddenly stopped working as intended. After investigating the problem, I discovered that the MouseMoved() event would stop firing any time that my mouse had moved past the middle of the Frame, but only after I’d left clicked the button for the slider. If I moved my mouse over the frame without clicking a slider, MouseMoved() would respond throughout, but if I held leftclick on a slider and tried moving the mouse, it’d only respond on the left half of the frame. This problem only applies to two sliders out of the three at a time and seems to randomly change which one is having said problem. The sliders are created in a loop, so they should all be running the same code, yet they’re having inconsistent behavior. Does anyone know why this might be occurring?

1 Like

The only different properties the sliders have are color, and they are all TextButtons. I have a short clip of the issue here.
https://gyazo.com/2893bb6c689a405e14d577f8cd395759

for index, sliders in pairs({misc.CSlideR, misc.CSlideG, misc.CSlideB}) do
	sliders.Slider.MouseButton1Down:connect(function()
		slidees[sliders.Name]=true
	end)
	
	sliders.Slider.MouseButton1Up:connect(function()
		slidees[sliders.Name]=false
	end)
	
	sliders.MouseMoved:connect(function(x, y)
		if slidees[sliders.Name] then
			if x>=20 and x<=380 then
				sliders.Slider.Position=UDim2.new(0, x, 0, 0)
				ccol[index]=((x-20)/360)
				refresh(false)
			end
		end
	end)
end

The loop is run only once when the GUI is given to the player by the server. The connections made by it persist until the player closes out of the UI. The ButtonDown and ButtonUp functions fire correctly as they’re meant to, but while the mouse is down, the Moved() event only works as long as the mouse’s x position is below 200 pixels. I tried changing the size of the GUI to see if the number would change, but it persisted at 200.

I’ve set the MouseMoved() function to print the X and Y coordinates of the mouse and it just stops printing as soon as the mouse reaches the 200 mark, no matter how slowly I move it.

I have another video of the slider’s seemingly random behavior here, where I repeatedly release and try to drag it, only for it to let itself go past the 200 pixel mark on the third try.
https://gyazo.com/fa2c6ff07fb496006825a8791eb5907d
The X position of the slider’s parent is 0, so I don’t need to subtract anything.
https://gyazo.com/983ab38383f5f67cdac0b449318c13ba
I’ve also taken a video of the output, displaying how when I’m holding left click it stops right before reaching 200, but if I release it, it functions perfectly throughout the whole frame.

After some more messing around, I’ve discovered that the problem only exists while there is a ScrollingFrame next to the slider’s frames. It appears that despite not overlapping, ScrollingFrames interfere with how the MouseMoved() of other frames fires.

I was able to fix the problem by moving the neighboring ScrollingFrame 1 pixel to the right.

I messed around with the UI layout a bit, and it seems that by having a ScrollingFrame side by side with the slider’s frame, it was preventing the MouseMoved function from firing under certain conditions. By moving the ScrollingFrame 1 pixel away from the slider frame, the problem has vanished.

I didn’t think a scrolling frame would interfere with anything outside of it, so I didn’t think it mattered that one was nearby.

1 Like

Fancy seeing you here Sol. Get it figured out yet?

I have actually fixed this bug without changing the size by enabling and disabling scrolling in the scrolling frame like this
image