im trying to make my car float up and down with a tween continuously without it tampering with my other functions. do you guys have any recommendations to clean this up? i have the velocity and tweens function in the same script.
local function floating_tweens()
return coroutine.create(function()
while zalek_data.car_isfloating.Value == true do
local currentCF = zalek:GetPivot()
local floatdown_CF = currentCF * CFrame.new(0, -5, 0)
local tinfo = TweenInfo.new(2.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true, 0)
zalek_data.floatTween = ts:Create(zalek.PrimaryPart, tinfo, {CFrame = floatdown_CF})
zalek_data.floatTween:Play()
zalek_data.floatTween.Completed:Wait()
if zalek_data.car_isfloating.Value == false then
break
end
task.wait()
end
end)
end