Changing the orientation of an Object in a CFrame with a script

Hello, is there a way to change the Orientation of an object in a CFrame.

part.CFrame = CFrame.Angles(math.rad(50),0,math.rad(20))

Yes, you can change the orientation of an object in a CFrame by using the lookVector, upVector, and rightVector properties of the CFrame.

Here’s an example:

-- Get the current CFrame of the part
local part = game.Workspace.Part
local cf = part.CFrame

-- Define a new lookVector and upVector for the part
local newLookVector =, 0, -1)
local newUpVector =, 1, 0)

-- Set the orientation of the CFrame using the new vectors
cf =, cf.Position + newLookVector, newUpVector)

-- Set the new CFrame for the part
part.CFrame = cf

In this example, we first get the current CFrame of a part in the game world. Then, we define new lookVector and upVector vectors for the part. Finally, we set the orientation of the CFrame using the constructor with the part’s current position and the new lookVector and upVector vectors. Finally, we set the new CFrame for the part.

You can adjust the newLookVector and newUpVector vectors to achieve the desired orientation for your object.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.