Tweening CFrame.lookAt() Not working

Hi!

  1. What do you want to achieve? I want to make a good airplane flight system that uses tweening to turn the aircraft towards your mouse.

  2. What is the issue? It doesn’t do anything.

  3. What solutions have you tried so far? I’ve looked on (what I believe is) 7 developer forum posts but they all say the exact same solution, which doesn’t work.

Here’s my code (It works if I do not tween at all).

print("preparing to run")		
	
game:GetService("TweenService"):Create(part,TweenInfo.new(1,Enum.EasingStyle.Circular,Enum.EasingDirection.In),{CFrame = CFrame.lookAt(script.Parent.Position,mousel.Position)}):Play()
				
print("should have ran")

Thank you!

What do you mean by “not works”? Does it not print the statements? Does it not tween? Where’s the rest of your script? Need more details.

It just doesn’t tween. Here’s the whole script:

game:GetService("RunService").Heartbeat:Connect(function()
	local sitter = script.Parent.Sitter
	if sitter.Value ~= "" and script.Parent.Anchored then
		local part = script.Parent
		local tween = game:GetService("TweenService"):Create(part, TweenInfo.new(
			1, 
			Enum.EasingStyle.Sine), 
			{CFrame = part.CFrame + (part.CFrame.LookVector * 10)}
		)

		tween:Play()
		workspace[sitter.Value].Aim.OnServerEvent:Connect(function(plr,mousel)
			if script.Parent.Anchored == true then
				--script.Parent.CFrame = CFrame.lookAt(script.Parent.Position,mousel.Position)
				
				print("preparing to run")
				
				game:GetService("TweenService"):Create(part,TweenInfo.new(1,Enum.EasingStyle.Circular,Enum.EasingDirection.In),{CFrame = CFrame.lookAt(script.Parent.Position,mousel.Position)}):Play()
				
				print("should have ran")
			end
		end)
	end
end)

You should never put a connection inside of a .HeartBeat if you aren’t gonna disconnect it, because that will cause a memory leak. Fix that first and see if your tween works after.

I forgot wether or not CFrame:LookAt works or not, but I think you’d want to use:

game:GetService("TweenService"):Create(part,TweenInfo.new(1,Enum.EasingStyle.Circular,Enum.EasingDirection.In),{CFrame = CFrame.new(part.Position - mouse1.Position)}):Play()

I tried this and it hasn’t changed.

Whaat was the error messageeee

There are no error messages, so I can’t really use the output for this.