I have 2 bricks: a red brick and a blue brick
Using SetPrimaryPartCFrame() how could I make the red brick face towards the blue
You can use one of CFrame’s constructors: CFrame.new(pos, lookat)
. pos is the origin, and lookat is the position you look at:
redBrick:SetPrimaryPartCFrame(CFrame.new(redBrick.Position, blueBrick.Position))
If you want a cframe value of a Vector3 point with the orientation to face another vector3 point, you can create a cframe like this: CFrame.new(vector3_1, vector3_2) or in this specific situation,
RedPart.CFrame = CFrame.new(RedPart.Position, BluePart.Position)
I also have a plugin that will easily do this and other cframe functions soon if you want to check that out.