MouseMovement on Mobile?

Hi there! Recently I was looking at making a colour wheel, however, in recent testing, I can’t figure out a way to make mouse movement on mobile, so it only really works on PC. I was just wondering, is there a way to replicate the function for mobile?

Here is the mousemovement script:

uis.InputChanged:Connect(function(input)
	if canchange == true then
		if input.UserInputType ~= Enum.UserInputType.MouseMovement then return end


		local mousePos = uis:GetMouseLocation() - Vector2.new(0, game:GetService("GuiService"):GetGuiInset().Y)

		local centreOfWheel = Vector2.new(colourWheel.AbsolutePosition.X + (colourWheel.AbsoluteSize.X/2), colourWheel.AbsolutePosition.Y + (colourWheel.AbsoluteSize.Y/2))

		local distanceFromWheel = (mousePos - centreOfWheel).Magnitude


		if distanceFromWheel <= colourWheel.AbsoluteSize.X/2 and buttonDown then

			wheelPicker.Position = UDim2.new(0, mousePos.X - colourWheel.AbsolutePosition.X, 0, mousePos.Y - colourWheel.AbsolutePosition.Y)


		elseif movingSlider then

			darknessSlider.Position = UDim2.new(darknessSlider.Position.X.Scale, 0, 0, 
				math.clamp(
					mousePos.Y - darknessPicker.AbsolutePosition.Y, 
					0, 
					darknessPicker.AbsoluteSize.Y)
			)	
		end


		updateColour(centreOfWheel)
	end
	
	
end)

Any help is appreciated

1 Like

Check UserInputType.Touch, too.

Edit: that might not actually work. You may need to listen to UserInputService | Roblox Creator Documentation instead.

1 Like