I am making a game where you aim a cannon at a castle and shoot

Consider the above image is a snapshot of the direction the cannon will be aiming

The cannon is going to point directly at the center of the model. The worldpivot.

A number will determine how far from center the cannon will aim and this is in degrees.
So 0 degrees is directly in the center.

The maximum degrees should be such that the cannon does not aim farther than the allowed positions.

The allowed positions will be. X studs to the left relative to the aiming direction of the cannon
and X studs to the right relative to the aiming direction of the cannon

where X is the extentssize of the model.

Remember the cannon isn’t directly positioned in front of the castle. It is positioned slightly to the side.

you can use CFrame.Lookvector to make the cannon shoot at what you want it to
if u want to make it so the cannon wont shoot unless pointed at the castle, you can use raycast to detect if the pointed at the castle