-
What do you want to achieve? The turret on the right should point at the turret on the left
-
What is the issue? It points in the correct direction but it moves to the center of the world
The code
local shipBody = script.Parent.Part
local target = workspace.Ships.Team1.Enemy1.Head
local CF = CFrame.new(shipBody.Weld.C1.Position,target.Position)
x,y,z = CF:ToEulerAnglesXYZ()
shipBody.Weld.C0 = shipBody.CFrame:ToObjectSpace(CFrame.Angles(x,y,z))
- What solutions have you tried so far? I’ve tried doing things like
shipBody.Weld.C0 = shipBody.CFrame:ToObjectSpace(shipBody.Weld.Part1.CFrame * CFrame.Angles(x,y,z))
which makes it so that it’s in the right spot but it doesn’t face the right direction.
I’ve tried other variations like using C0 and C1 instead of part1.Cframe and those all end up in the middle of the world
I can’t use CFrame.new(position, TargetPosition) to make it look because the “ship” is going to be able to move and that results in this problem