In this tutorial, you should be in Roblox Studio. Now, what may you ask, is a Body Position? Well, a body position is a way to position something using Roblox's physics. The object will try to zoom to the point identified by the position, and will try using the amount of force defined. Now this can be helpful. What if you define that there is a lot of force on the Y axis (Up/Down), but not on a lot on the X/Z axis (Left/Right and Forward/Back). In this case, you created a floating brick, that can move anywhere. This can be quite helpful in creating hover crafts or ships. Another useful thing, is to remember that it will try to get to the position, but it won't necessarily get there. So if a brick that is anchored is in the way, that part probably won't get to the objective.
First, make a small brick. I made mine 5x1x5. Next, select the brick you just made and click Insert->Object->Script. Now double-click the new script object.
You should see the following:
Delete that text, you won't need it.
First, add this code.
This code will detect when something touches it.
This will detect whether what touched it was a human or not. You don't want a rocket or slingshot to activate it, do you?
Okay, this code defines our BodyPosition object. But right now it doesn't do anything, because it doesn't have a parent yet.
This will define some of BodyPosition's properties.
So far we have this:
So far, you'll fly to the point. But when will you drop? Thats a problem we have to fix. Let's try this:
Now, after 3 seconds, the BodyPosition ceases to exist, and you will drop! Now we just have to clean up the functions, and actually connect it to the Touched property!
There we go! those ends end the if statement and the function. Let's see the whole script.
If you want to change where the character flies to, then you can change the BodyPosition's position property. Also, something really fun is if you only wait(0.1) then the character goes flying!