for x=1,#ColorPickers,1 do for B=1,#RGBSliders[x],1 do local function t(x)if x.UserInputType==Enum.UserInputType.MouseButton1 then IsDraggingSliders[B]=false end end RGBSliderHitboxes[x][B].InputEnded:Connect(t)local function W()if not IsDraggingSliders[B]then IsDraggingSliders[B]=true end while IsDraggingSliders[B]do wait()local t=Plugin:GetRelativeMousePosition()if OldMouseLocation~=t then RGBSliderMovement(t.X,x,B)OldMouseLocation=t end end IsDraggingSliders[B]=false end RGBSliderHitboxes[x][B].MouseButton1Down:Connect(W)local function w()if tonumber(RGBInputs[x][B].Text)==nil then RGBInputs[x][B].Text="\048"elseif tonumber(RGBInputs[x][B].Text)<=0 then RGBInputs[x][B].Text="\048"elseif tonumber(RGBInputs[x][B].Text)>=256 then RGBInputs[x][B].Text="\050\053\053"end PreviewColor[x].BackgroundColor3=Color3.fromRGB(tonumber(RGBInputs[x][1].Text),tonumber(RGBInputs[x][2].Text),tonumber(RGBInputs[x][3].Text))RGBSliders[x][B].Position=UDim2.new(0,PreviewColor[x].BackgroundColor3[rgb[B]]*RGBSliderHitboxes[x][B].AbsoluteSize.X,RGBSliders[x][B].Position.Y.Scale,0)end RGBInputs[x][B].FocusLost:Connect(w)end end

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

