X orientation only changing on the z?

When I set my y and x orientation my y changes just fine but my x will only change on the z?


ShopCamModule.ShopCam(ShopCam,0,90,0,20,5,0)



CameraPart.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position + Vector3.new(X,HEIGHT_OFFSET,CAMERA_DEPTH))*CFrame.Angles(math.rad(OrX),math.rad(OrY),0)

1 Like

can u give more description???

theres no information to go off of in your post. Its like asking “why is my script throwing an error” then posting one line of code

So what’s happening is I have variables set to easily change the orientation of a brick that functions as my game’s camera,


	
	CamTest = function(CameraPart,OrX,OrY,OrZ,X,HEIGHT_OFFSET,CAMERA_DEPTH)

		if HEIGHT_OFFSET == nil and CAMERA_DEPTH == nil then
			HEIGHT_OFFSET = 4
			CAMERA_DEPTH = 15
		else
			HEIGHT_OFFSET = HEIGHT_OFFSET
			CAMERA_DEPTH = CAMERA_DEPTH
		end
		if OrX == nil then

			OrX = -20

		elseif OrX ~= nil then
			OrX = OrX


		end
		if OrY == nil then
			OrY = 0
		elseif OrY ~= nil then

			OrY = OrY

		end

		if X == nil then

			X = 0

		elseif X ~= nil then

			X = X

		end
		
		
		
		
		local function updateCamera()
			local character = player.Character
			if character then
				local root = character:FindFirstChild("HumanoidRootPart")
				if root then

					CameraPart.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position + Vector3.new(X,HEIGHT_OFFSET,CAMERA_DEPTH))*CFrame.Angles(math.rad(OrX),math.rad(OrY),0)

				end
			end
		end


		

		RunService:BindToRenderStep("Side", Enum.RenderPriority.Camera.Value + 1, updateCamera)
	
	end,


When I change both my X and Y here


ShopCamModule.ShopCam(ShopCam,
-20, -- X Orientation
90, -- Y Orientation
0, -- Z Orientation




The Brick ends up like this
image
image

you might want to read up here to get a better understanding of setting a Part’s orientation

https://developer.roblox.com/en-us/api-reference/property/BasePart/Orientation

the article says the following:

The Orientation property describes the part’s rotation in degrees around the X, Y and Z axes using a Vector3. The rotations are applied in Y → X → Z

as well as:

It is also worth noting how this property differs from the CFrame.Angles() constructor, which applies rotations in a different order (Z → Y → X). For better control over the rotation of a part, it is recommended that BasePart.CFrame is set instead.