wait(3)
local tweenService = game:GetService("TweenService")
local part1 = script.Parent
local part2 = game.Workspace.FacePart -- The part that part1 will face
local direction = (part2.Position - part1.Position).Unit
local angle = math.atan2(direction.y, direction.x)
local goal = CFrame.new(part1.Position) * CFrame.Angles(0, angle, 0)
local info = TweenInfo.new(1, Enum.EasingStyle.Linear) -- Tween for 1 second with linear easing
local tween = tweenService:Create(part1.Torso, info, {C0 = goal})
tween:Play()
So right now, this is a part of a tank model. The tank has a body, head, and cannon attached to the head. They are all connected together using Motor6D.
When this script runs though, instead of tweening/rotating the head on the Y axis the amount I specified. The head flings off into the sky and breaks the Motor6D it appears. How can I fix this?