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.
What is the issue? It doesn’t do anything.
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")
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.