So I have this simple script here, to make an orb smoothly float up and down.
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local orb = script.Parent
local sizeIncrease = 3
local floatDistance = 3
while true do
local tweenUp = TweenService:Create(orb, tweenInfo, {["Position"] = orb.Position + orb.CFrame.UpVector * floatDistance})
local tweenDown = TweenService:Create(orb, tweenInfo, {["Position"] = orb.Position + orb.CFrame.UpVector * -floatDistance})
tweenUp:Play()
wait(5)
tweenDown:Play()
wait(5)
end
It works pretty well. But for some reason, the orb floats down too far. What’s causing this? i’m confused.