Help needed with CFrames

I have recently been using CFrames, but have been having trouble getting it to work properly. I’m using CFrame.lookAt, but I can’t get the side of the the part in question to face the desired point(Its currently the front). here’s the script:
script.Parent.CFrame = CFrame.lookAt(,10,0),,0,0))
How can I get a different face to look at the specified point?

1 Like

hey there i believe you’re trying to make the part look at another part, don’t confuse yourself, it’s as simple as this!

script.Parent.CFrame =,10,0),,0,0))

this code makes the said part looks from the first position towards the second position.

1 Like

Here are some examples on how you would get a certain side of a part to face a certain direction.
Not the most efficient way to do it by any means, but it works:

-- Front side facing target
local cf1 =,10,0),,0,0))

-- Back side facing target
local cf2 =,10,0),,0,0))
cf2 = CFrame.lookAt(cf2.Position, cf2.Position - cf2.LookVector, cf2.UpVector)

-- Right side facing target
local cf3 =,10,0),,0,0))
cf3 = CFrame.lookAt(cf3.Position, cf3.Position - cf3.RightVector, cf3.UpVector)

-- Left side facing target
local cf4 =,10,0),,0,0))
cf4 = CFrame.lookAt(cf4.Position, cf4.Position + cf4.RightVector, cf4.UpVector)

-- Top side facing target
local cf5 =,10,0),,0,0))
cf5 = CFrame.lookAt(cf5.Position, cf5.Position - cf5.UpVector, cf5.LookVector)

-- bottom side facing target
local cf6 =,10,0),,0,0))
cf6 = CFrame.lookAt(cf6.Position, cf6.Position + cf6.UpVector, -cf6.LookVector)

Hope this helps!

Nope, that doesn’t seem to do anything at all.

Well I tested it on my end and it worked,
So there’s nothing more I can really do.

Hope you figure it out!

Edit: Just to make sure, if you wanted the right side of a part to face the target, your script would look something like this:

local position =,10,0)
local target =,0,0)
script.Parent.CFrame = CFrame.lookAt(position, target)
script.Parent.CFrame = CFrame.lookAt(
    script.Parent.CFrame.Position - script.Parent.CFrame.RightVector, 

Written in the form your example showed.
Can’t test this one out myself so its all up to you now.

Edit 2: better code format

Studying this might help. It certainly did for me.

Got you

local currentPos = script.Parent.Position
local desiredPos =, 15, 0)

local whichFace = Enum.NormalId.Front -- change to whatever face you want
local inVector3Form = Vector3.FromNormalId(whichFace)

script.Parent.CFrame = CFrame.lookAt(currentPos, desiredPos) * CFrame.Angles(0, math.pi/2, 0) * CFrame.Angles(math.asin(inVector3Form.X), math.asin(inVector3Form.Z), math.asin(-inVector3Form.Y))

Nice work, Just what I needed. Big thanks for your help.

1 Like