How to make a part float up and down slowly?

So i know how to rotate a part like this

script.Parent.CFrame = script.Parent.CFrame*CFrame.Angles(0,math.rad(5),0

but i wanna make a part float up and down like levitate, how do i do that?

I figured it out guys, no need for help ty

1 Like

I think

Local TargetCframe = script.Parent.CFrame + CFrame.new(0, 10, 0)

Then make a tween function that tweens to that position and have the reverses Boolean to true.


Local TargetCframe = script.Parent.CFrame + CFrame.new(0, 10, 0)

local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(
    1, 
    Enum.EasingStyle.Linear, 
    Enum.EasingDirection.InOut,
    0,
    true,
    0 
)

local tween = TweenService:Create(script.Parent, Info, {CFrame = TargetCFrame})

While true do

tween:Play()
wait(1) -- optional!
end


Well there’s a script loop if you need it :grimacing:

thank you my friend, i will try your script too

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.