You can use CFrame.new(pos, lookAt) and CFrame:ToObjectSpace() to help with rotating around, and math.atan2 to help with up/down. origin is the part that is each motor’s Part0. (In the “rotate around” portion, origin is aroundMotor’s Part0, and in the “rotate up and down” portion, it is upMotor’s Part0):
-- rotate around
local dir = (target.Position - origin.Position).Unit * Vector3.new(1, 0, 1)
aroundMotor.C0 = origin.CFrame:ToObjectSpace(CFrame.new(origin.Position, origin.Position + dir)
-- rotate up and down
local dir = (target.Position - origin.Position)
local angle = math.atan2(dir.y, dir.z)
upMotor.CFrame = CFrame.new(origin.Position) * CFrame.Angles(angle, 0, 0)
Instead of trying to mess with welds, I always just attach the turret to the body of the vehicle with a HingeConstraint, then use BodyGyro to make it rotate. The BodyGyro’s CFrame would be set using CFrame.new(pos, lookAt). Same concept for making it move up and down. If you want, you can do some math to implement limits too, so that the turret won’t rotate beyond a certain point.