Personal recommendation: don’t work in radians unless you’re totally comfortable with them. Roblox is just being difficult when they require them.
What you need to learn for this is trigonometrical ratios.
Here is a triangle. Hypotenuse is the big long part (it’s always the longest side), opposite is the one to the side, and adjacent is the one that, if you drew a line from the normal of the hypotenuse (middle) you’d touch it. Don’t worry too much about this for now.
This applies to any right-angled triangle (has one 90 degree angle in it). You can tell it’s a right angled triangle as it has a square in one of the corner.
Now, the you may be aware of functions on your calculator called sin, cos, and tan. Look funky, right? Well, they’re your new friends for anything angle. They dictate the ratios between triangles in a circle radius (you’ll probably learn about this more in school later on), and you can use them to find the angles.
So. There are three main rules for right angled triangles, and based on what values you know or want to find you have to decide which one to use. This is SOHCAHTOA.
So, SOHCAHTOA is an acronym for the ratios, which are:
Sin(angle) = opposite / hypotenuse
Cos(angle) = adjacent / hypotenuse
Tan(angle) = opposite / adjacent
Example: if you want to find the hypotenuse, and you know the angle and the opposite, you eliminate the ones you can use:
Tan(angle) = opposite / adjacent
This equation doesn’t have any mention of hypotenuse, so you shouldn’t try calculating the hypotenuse from it (obviously)
Cos(angle) = adjacent / hypotenuse
This equation does have hypotenuse, but you don’t know the adjacent! You can’t use this one either.
Sin(angle) = opposite / hypotenuse
Hey! You know angle and opposite, and want to find hypotenuse! This is the one.
So, to use this, let’s pretend the angle is 45 degrees, and the opposite is 12 cm
Sin(45) = 12 / hypotenuse
So, rearranged, we can find hypotenuse
Hypotenuse = 12 / Sin(45)
So, we’ve just found the hypotenuse! Score
Now, in your case, you want to find the opposite, when you know the hypotenuse and opposite, and angle! You’re being spoilt. You can do:
Sin(angle) = opposite / hypotenuse
OR
Tan(angle) = opposite / adjacent
Let’s rearrange again.
Sin(5) = opposite / 50
(Let hypotenuse be 50)
So, hence
Opposite = 50 x Sin(5)
Let’s turn this into Lua now!
local hyp = 50
local angle = 5
local opp = hyp * math.sin(math.rad(angle)) // radians because Roblox is difficult
print(“found it! Answer is ” .. tostring(opp))
Hope this helps