Hello, I have a model im trying to tween to hover back and forth. For some reason despite me declaring origin and goal CFrames, when it plays the tween it will move slowly to the target then suddenly start teleporting to random positions and eventually out of the world.
Here is my code:
local root = script.Parent.Main
local origin = CFrame.new(root.Position.X,root.Position.Y,root.Position.Z) --* CFrame.Angles(0,math.rad(0),0)
local goal = CFrame.new(root.Position.X,root.Position.Y+5,root.Position.Z) --* CFrame.Angles(0,math.rad(180),0)
local tween = game:GetService("TweenService"):Create(root,TweenInfo.new(10,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{CFrame = goal})
local back = game:GetService("TweenService"):Create(root,TweenInfo.new(10,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{CFrame = origin})
root.corrupt:Play()
while wait() do
tween:Play()
tween.Completed:Wait()
back:Play()
back.Completed:Wait()
end
Any help is appreciated!