local aimTweenInfo = TweenInfo.new(.1)
local lookAt = CFrame.lookAt(script.Parent.Head.Position, player.Character.Head.Position)
local aimTween = tweenService:Create(script.Parent.Head, aimTweenInfo, {["CFrame"] = lookAt})
aimTween:Play()
aimTween.Completed:Wait()
No errors, but nothing happens; there is no movement, no CFrame.lookAt going on.
How can I do this?
NOTE: I am attempting to tween CFrame.lookAt, so it isn’t just a sudden jerk move, but a smooth turning. If there is a better way to do this, please share.
while wait() do
local lookAt = CFrame.lookAt(script.Parent.Head.Position, player.Character.Head.Position)
script.Parent.Head.CFrame = (script.Parent.Head.CFrame) + ((lookAt - script.Parent.Head.CFrame.lookAt) / 5)
end
I am unsure that you can directly edit the head’s CFrame unfortunately, especially if it’s connected to a character, which would mean it works thanks to a Motor6D, which is the instance you need to edit here. And no, using CFrame.lookAt() like you’re doing in the script you shared, will not work on Motor6Ds sadly.
However, have no fear! A very kind user shared his solution with us, which is a function he himself made, that allows you to use CFrame.lookAt on Motor6Ds and even welds. Here’s the link if you need it: