Given a sloped part between two walls, how can I position a wedge/triangle to fit relative to the sloped part.

What is the issue?

I essentially want the triangle to fit where black line is drawn, according to the orientation of the long skinny part shown. The second image is the result I’m trying to achieve.

What solutions have you tried so far?
I know how to regularly position parts relative to orientation, but the fact that the part I’m attempting to angle is a wedge is making it more difficult for me. Another issue is that the steepness of the hypotenuse has to be taken into account when positioning the triangle so that it fits cleanly along the skinny part’s left side.

So you’re trying to make a roof that’s angled on both sides at the corner?
I would place a triangle on the top of the wall matching the outer edge and use the Studio Build Suite - Roblox plugin. Select the SelectEdge tool and change the top number to something like 0.1 (degrees), then select the bottom edge of the triangle and use the Rotate handle to tilt the triangle until it matches your angled Part. You’ll probably have to resize the triangle to make it match properly with the angled Part.

Are you making a building game and that’s why you need a script?

If you imagine the angled part as a box with X,Y, and Z axes, then you can do the calculation to figure out the length of the Part’s hypotenuse and the angle it should be applied at.
Are you making a building game and that’s why you need a script?

In this example the corner skinny Part is at 45ᵒ from the corner and is angled up at 30ᵒ.
The transparent red rectangle is 4x4 at the base, but we don’t know the exact height of our 4x4 rectangle Part yet.
To figure out the length of the diagonal at the base of the red rectangle (sides x and z, the green triangle’s hypotenuse) we need to use Pythagorus’ Theory (x² + y² = z²) to get that length.
It would be 4² + 4² = 32, and the square root of 32 is 5.657.

Trigonometry has a neat way of remembering how to use Sine, Cosine and Tangent of the angle. SOH CAH TOA which is how to place the lengths of the sides in each section of the formula. Sine = Opposite side / Hypotenuse side, Cosine = Adjacent side / Hypotenuse side, Tangent = Opposite side / Adjacent side.
In this case we have the length of the green diagonal (Hypotenuse side = 5.657) and the angle the skinny part is from the level surface (30ᵒ) so we use trigonometry to figure out the height of the red rectangle and blue triangle. Tangent = Opposite over Adjacent, so now we solve for the Opposite side using the formula:
math.tan(30) = Opposite side length / 5.657 or
0.57735 = Opposite / 5.657
so instead of dividing the left side of the equation by 5.657 we can do the opposite and multiply it by 5.657 on the right side of the equation!
0.56636 x 5.657 = Opposite (or 3.266)
So now we know the height of our blue triangle is 3.266! If we use Pythagorus again we can do this:
3.266² + 4² = 26.667.
The square root of 26.667 is 5.164 studs and that’s the length of our blue triangle side!

Thank you for the visualization with the cube, it helped me understand this a lot better, and yes I needed a script like this for a building game I’ve been working on. Thanks for the help!