Object rotate by mouse issue

  1. I have an issue with rotating an object using the mouse, specifically when I move the object along the Y-axis (i.e., move the mouse downwards), it rotates correctly. However, when I grab the object from the other side, it rotates incorrectly.

  2. Example:

  3. I don’t know how to solve this and I hope for assistance. I’m ready to provide all the necessary information

   	if rotate then
			local mousedelta = uis:GetMouseDelta()
			rotateCFrame = (CFrame.Angles(0,math.rad(-(mousedelta.X*10000)),0)*CFrame.Angles(math.rad(-(mousedelta.Y*10000)),0,0))  * rotateCFrame
		end

.