I need help with getting the weld to face the direction that the mouse is pointing to, so far the turret is turning, though it's facing the opposite side that the mouse is pointing. This is what I have so far;
local offset = (Turret.Connector.Position - Mouse.Hit.p)
local direction = offset.Unit
local angle = math.atan2(direction.Z, direction.X) + math.pi
local angle2 = math.asin(direction.Y)
VerticalValue.Value.Value.C0 = CFrame.new(VerticalValue.Value.Value.C0.p) * CFrame.Angles(0, direction.X, 0)

3 comments
If it works perfectly, but is facing the wrong way, just try changing some things to negative.
I attempted to do so though it still had faults, I instead replaced it with a hinge and it's working perfectly. Thanks though
I made a script to make a player's arms point towards the mouse using the manipulation of their arm welds.. maybe you could implement it into this code somehow? It's in my models.