I want set to where player’s mouse is pointing at. How to do it?
I tried this

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function()
workspace.Maus.Turret.CylindricalConstraint.TargetAngle = Mouse.Hit.LookVector.X * 50
end)

but it doesn’t rotate the tank’s turret to all positions to where player’s mouse is pointing at.

I’ve never worked with this object before but If I were to guess you’d probably have to find the angle between your Mouse’s LookVector relative to the Cylinder, and the Cylinder’s current LookVector, if that makes sense? Idk someone correct me

This might look something like this

local cylinderCurrentLookVector = whatever
local mouseCurrentLookVector = Mouse.Hit.LookVector
local dotProduct = cylinderCurrentLookVector:Dot(mouseCurrentLookVector)

Looking at this image, we know that the dot product is equal to
the product of the magnitude of both vectors, then multiplied by the cosine of the angle(theta)

therefore:

-- our dotProduct formula
dotProduct = cos(theta) * (cylinderCurrentLookVector.Magnitude * mouseCurrentLookVector.Magnitude)
-- transpose so that cos(theta) is the subject
-cos(theta) * dotProduct = (cylinderCurrentLookVector.Magnitude * mouseCurrentLookVector.Magnitude)
-cos(theta) = (cylinderCurrentLookVector.Magnitude * mouseCurrentLookVector.Magnitude) / dotProduct
-- now that we're trying to find theta, aka our angle and not the ratio we can go ahead and find the
-- inverse cosine of our formula to get theta
theta = -math.acos((cylinderCurrentLookVector.Magnitude * mouseCurrentLookVector.Magnitude) / dotProduct)

This should be your overall formula to finding the angle between the two vectors, I’m not too sure how the CylindricalConstraint works like I said, but I’m guessing if you plug theta into the TargetAngle it may rotate the Cosntraint on the axis

That’s the thing I was wondering about, is it possible for you to send a placefile for me so I can experiment a bit or I’ll just go make a new one and see