CLICK FOR PICTURE So in that picture there's a brick with two CFrames colored in blue. What I want to do is CFrame the gray brick so that it attaches between the two green points, therefore making the brick occupy the red area. Problem is, everything I try to get the green points won't work for me, so I came here for help. I already tried Lerping the CFrames but it just goes to the same exact spot every time. ANY help is greatly appreciated. Thanks!
✓ ANSWER ACCEPTED
Help with CFraming?
1 answer
✓ Accepted answer
I believe this will work:
local to = red.CFrame:vectorToObjectSpace( Vector3.new(0, 1, 0) )
green.CFrame = red.CFrame
* CFrame.new(Vector3.new(), to * Vector3.new(1, 0, 1))
The idea is determining which way is "up" relative to where it was, and then rotate towards that, but only around the Y axis.
1 comment
0
Words cannot describe how thankful I am for this tiny seemingly worthless piece of code. THANK YOU SO MUCH! You yourself has really helped me, even through past questions I have asked. Thank you so much BlueTaslem.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
What exactly are you trying to do? Your question is a little too vague and/or poorly worded to properly explain your intentions. Are you meaning to make the grey brick at the end align with the red line?
That is correct. Sorry if the visual/wording is confusing to you, I tried my best.
This picture is better: https://gyazo.com/bf331471e0ee6e574f82b7b004ec8a6e
As I understand it, the Green is the Red rotated about its Y axis so that it points as vertically as possible (the plane defined by the part's YZ is perpendicular to the floor XZ plane)
Correct. This picture is even better. https://gyazo.com/791d3df8134be1c59cf2fe67a9639c28