-
What do you want to achieve? I have a system where when tower attacks it faces target and i wanna make the tower’s head look at the target primary part position and i wanna make that work with animations
-
What is the issue? I tried to make it but i failed many times that i had to put everything back to normal
-
What solutions have you tried so far? i looked i dev forum and there’s nothing similar to this
function tower.FaceTarget(newTower, target, duration)
local targetVector = Vector3.new(target.PrimaryPart.Position.X, newTower.PrimaryPart.Position.Y, target.PrimaryPart.Position.Z)
local targetCFrame = CFrame.new(newTower.PrimaryPart.Position, targetVector)
local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local faceTargetTween = TweenService:Create(newTower.PrimaryPart, tweenInfo, {CFrame = targetCFrame})
faceTargetTween:Play()
end