for U=1,#ColorPickers,1 do for A=1,#RGBSliders[U],1 do local function o(U)if U.UserInputType==Enum.UserInputType.MouseButton1 then IsDraggingSliders[A]=false end end RGBSliderHitboxes[U][A].InputEnded:Connect(o)local function K()if not IsDraggingSliders[A]then IsDraggingSliders[A]=true end while IsDraggingSliders[A]do wait()local o=Plugin:GetRelativeMousePosition()if OldMouseLocation~=o then RGBSliderMovement(o.X,U,A)OldMouseLocation=o end end IsDraggingSliders[A]=false end RGBSliderHitboxes[U][A].MouseButton1Down:Connect(K)local function B()if tonumber(RGBInputs[U][A].Text)==nil then RGBInputs[U][A].Text="\048"elseif tonumber(RGBInputs[U][A].Text)<=0 then RGBInputs[U][A].Text="\048"elseif tonumber(RGBInputs[U][A].Text)>=256 then RGBInputs[U][A].Text="\050\053\053"end PreviewColor[U].BackgroundColor3=Color3.fromRGB(tonumber(RGBInputs[U][1].Text),tonumber(RGBInputs[U][2].Text),tonumber(RGBInputs[U][3].Text))RGBSliders[U][A].Position=UDim2.new(0,PreviewColor[U].BackgroundColor3[rgb[A]]*RGBSliderHitboxes[U][A].AbsoluteSize.X,RGBSliders[U][A].Position.Y.Scale,0)end RGBInputs[U][A].FocusLost:Connect(B)end end
------[RGB_SLIDER_MOVEMENT, RGB_TEXT_CHANGED]------
for z = 1, #ColorPickers do
	for i = 1, #RGBSliders[z] do
		----[STOP RGB SLIDER MOVEMENT]----
		local function RGBSliderEnded(Input)
			if Input.UserInputType == Enum.UserInputType.MouseButton1 then
				IsDraggingSliders[i] = false
			end
		end
		RGBSliderHitboxes[z][i].InputEnded:Connect(RGBSliderEnded)

		----[CHECK FOR RGB SLIDER MOVEMENT]----
		local function CheckForRGBSliderMovement()
			if not IsDraggingSliders[i] then
				IsDraggingSliders[i] = true
			end
			while IsDraggingSliders[i] do --and UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
				wait()
				local MouseLocation = Plugin:GetRelativeMousePosition()
				if OldMouseLocation ~= MouseLocation then
					RGBSliderMovement(MouseLocation.X, z, i)
					OldMouseLocation = MouseLocation
				end
			end
			IsDraggingSliders[i] = false
		end
		RGBSliderHitboxes[z][i].MouseButton1Down:Connect(CheckForRGBSliderMovement)

		----[CHECK IF RGB TEXT CHANGED]----
		local function RGBTextChanged()
			if tonumber(RGBInputs[z][i].Text) == nil then
				RGBInputs[z][i].Text = "0"
			elseif tonumber(RGBInputs[z][i].Text) <= 0 then
				RGBInputs[z][i].Text = "0"
			elseif tonumber(RGBInputs[z][i].Text) >= 256 then
				RGBInputs[z][i].Text = "255"
			end

			PreviewColor[z].BackgroundColor3 = Color3.fromRGB(
				tonumber(RGBInputs[z][1].Text),
				tonumber(RGBInputs[z][2].Text),
				tonumber(RGBInputs[z][3].Text)
			)
			RGBSliders[z][i].Position = UDim2.new(
				0,
				PreviewColor[z].BackgroundColor3[rgb[i]] * RGBSliderHitboxes[z][i].AbsoluteSize.X,
				RGBSliders[z][i].Position.Y.Scale,
				0
			)
		end
		RGBInputs[z][i].FocusLost:Connect(RGBTextChanged)
	end
end
