I am making a game with guards that walk around. There is a part in front of the guard which lets you see how far the guard can see that uses region3, however, with my script, regions get off on some guards and perfect on other guards. I use the same line for every guard
CFrames include rotation in the form of a LookVector.
The LookVector is just a vector representing the direction of the CFrame.
CFrame.new(pos, lookPos)
-- Is the same as
CFrame.new(pos, pos+lookVector)
Multiplying CFrames is like adding them. To subtract a CFrame you use CFrame:Inverse():
cf1 * cf2:Inverse()
To create a CFrame from angles you use this:
CFrame.Angles(math.rad(180), 0, math.rad(95)) -- math.rad converts degrees to radians. Radians are what CFrame.Angles takes unlike Part.Rotation
When multiplying CFrames:
Negative Z is forward
Positive Z is backwards
Positive X is left
Negative X is right
Positive Y is up
Negative Y is down
These are relative to the part’s faces. The lookVector represents the forwards look direction in a unit vector (a vector with a total distance aka magnitude of 1)
If the part is looking in the positive Z direction its lookVector would look like this: