# Levitation Part

Hello,

Hello developers. I started working on obby and can anyone help me how to execute the script to make the block float up and down.

You don’t need give me a code. I need some tips and good tutorial.

Regards,
Kuba

1 Like

Please give a script and a better explanation of what you are in need of understanding.

I need a code. I looking for tutorial on yt but I no found anything.

No, it’s against rules to ask for a code.

There’s three ways I would approach this.

1. Using body velocity to move the part up or down.
2. Using for loops to set the position.
3. Using tween service to tween move the part.

The scripting support section is not here to write code for you, but if need help understanding or fixing bugs then we’re willing to help.

2 Likes

This category is here to help. I’m not saying somebody write code for me. Maybe give me a link to some good tutorial.

Okay, could you change it up a bit? It sounds like you were asking for a code straight up. And you still need to give a better explanation of what you need. Because right now, I have no clue.

Next time please give code. I will not give code, but rather explain how it might work. To make something float up and down, you can use the math.sin(x) function. If you graph a sin wave, you’ll notice that it goes up and down forever in a wave formation. By saying something like `local partPos = currentPos*math.sin(t)` (t being a value that increments by a small value) you can make it appear as if it is floating. This works because the value of sin(t) will oscillate from -1 to 1.

2 Likes

There is also bodyPosition, @MrGalaretka This is what I would use for your situation also the most basic(aka. one of the first roblox tutorials for scripting) has a tutorial on how to make an obby and body position https://www.youtube.com/watch?v=dqyJk0w2AY0

Use Tween Service or use a for i = num1, num2, incre do

im not giving you the code but im gonna tell you what to do with it.

num1 = starting point (down)
num2 = ending point (up)
incre = time between numbers.

for using tweenservice, you should study this video: https://www.youtube.com/watch?v=pKbQbCf9i90