<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=How_To_Use_BodyPosition</id>
	<title>How To Use BodyPosition - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=How_To_Use_BodyPosition"/>
	<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=How_To_Use_BodyPosition&amp;action=history"/>
	<updated>2026-07-28T17:04:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.starfall.wtf/index.php?title=How_To_Use_BodyPosition&amp;diff=428&amp;oldid=prev</id>
		<title>PRG: Created page with &quot;==Introduction== In this tutorial, you should be in Roblox Studio.  == Setup == First, make a small brick. I made mine 5x1x5. Next, select the brick you just made and click Insert-&gt;Object-&gt;Script. Now double-click the new script object.  == Code ==   You should see the following: &lt;pre&gt; print(&quot;Hello World!&quot;) &lt;/pre&gt; Delete that text, you won&#039;t need it.  First, add this code. &lt;pre&gt; function onTouched(hit) &lt;/pre&gt; This will detect when something touches it.  &lt;pre&gt;local h...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=How_To_Use_BodyPosition&amp;diff=428&amp;oldid=prev"/>
		<updated>2024-12-10T13:43:35Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Introduction== In this tutorial, you should be in &lt;a href=&quot;/index.php/Roblox_Studio&quot; class=&quot;mw-redirect&quot; title=&quot;Roblox Studio&quot;&gt;Roblox Studio&lt;/a&gt;.  == Setup == First, make a small brick. I made mine 5x1x5. Next, select the brick you just made and click Insert-&amp;gt;Object-&amp;gt;Script. Now double-click the new script object.  == Code ==   You should see the following: &amp;lt;pre&amp;gt; print(&amp;quot;Hello World!&amp;quot;) &amp;lt;/pre&amp;gt; Delete that text, you won&amp;#039;t need it.  First, add this code. &amp;lt;pre&amp;gt; function onTouched(hit) &amp;lt;/pre&amp;gt; This will detect when something touches it.  &amp;lt;pre&amp;gt;local h...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Introduction==&lt;br /&gt;
In this tutorial, you should be in [[Roblox Studio]].&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
First, make a small brick. I made mine 5x1x5.&lt;br /&gt;
Next, select the brick you just made and click Insert-&amp;gt;Object-&amp;gt;Script.&lt;br /&gt;
Now double-click the new script object.&lt;br /&gt;
&lt;br /&gt;
== Code == &lt;br /&gt;
&lt;br /&gt;
You should see the following:&lt;br /&gt;
&amp;lt;pre&amp;gt; print(&amp;quot;Hello World!&amp;quot;) &amp;lt;/pre&amp;gt;&lt;br /&gt;
Delete that text, you won&amp;#039;t need it.&lt;br /&gt;
&lt;br /&gt;
First, add this code.&lt;br /&gt;
&amp;lt;pre&amp;gt; function onTouched(hit) &amp;lt;/pre&amp;gt;&lt;br /&gt;
This will detect when something touches it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;local h = hit.Parent:findFirstChild(&amp;quot;Humanoid&amp;quot;)&lt;br /&gt;
if h ~= nil then&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will detect whether what touched it was a human or not. You don&amp;#039;t want a rocket or slingshot to activate it do you?&lt;br /&gt;
&amp;lt;pre&amp;gt;local b = Instance.new(&amp;quot;BodyPosition&amp;quot;)&amp;lt;/pre&amp;gt;&lt;br /&gt;
Ok, this defines our Bodyposition. But right now it doesn&amp;#039;t do anything, because it doesn&amp;#039;t have a parent.&lt;br /&gt;
&amp;lt;pre&amp;gt;b.position = Vector3.new(500, 500, 500)&lt;br /&gt;
b.maxForce = Vector3.new(500000000, 500000000, 500000000)&lt;br /&gt;
b.Parent = hit.Parent.Torso&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will define some of BodyPosition&amp;#039;s properties. &lt;br /&gt;
*BodyPosition&amp;#039;s position property does this: When a BodyPosition has a parent, it will make the parent fly to the BodyPosition&amp;#039;s position property. It&amp;#039;s great for a lot of things, like teleporting without teleporting.&lt;br /&gt;
*maxForce property is how much force can be put on each axis of the parent brick. It also governs how far away the BodyPosition can be from it&amp;#039;s position property before it will take a brick there.&lt;br /&gt;
*The Parent of the BodyPosition is what the BodyPosition will be moving, in this case, the character&amp;#039;s torso.&lt;br /&gt;
&lt;br /&gt;
So far we have this:&lt;br /&gt;
&amp;lt;pre&amp;gt;function onTouched(hit)&lt;br /&gt;
  local h = hit.Parent:findFirstChild(&amp;quot;Humanoid&amp;quot;)&lt;br /&gt;
  if h ~= nil then&lt;br /&gt;
    local b = Instance.new(&amp;quot;BodyPosition&amp;quot;)&lt;br /&gt;
    b.position = Vector3.new(500, 500, 500)&lt;br /&gt;
    b.maxForce = Vector3.new(500000000, 500000000, 500000000)&lt;br /&gt;
    b.Parent = hit.Parent.Torso&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So far, you&amp;#039;ll fly to the point. But when will you drop? Thats a problem we have to fix. Let&amp;#039;s try this:&lt;br /&gt;
&amp;lt;pre&amp;gt;wait(3)&lt;br /&gt;
b.Parent = nil&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;  end&lt;br /&gt;
end&lt;br /&gt;
script.Parent.Touched:connect(onTouched)&amp;lt;/pre&amp;gt;&lt;br /&gt;
There we go! those ends end the if statement and the function. Let&amp;#039;s see the whole script.&lt;br /&gt;
&amp;lt;pre&amp;gt;function onTouched(hit)&lt;br /&gt;
  local h = hit.Parent:findFirstChild(&amp;quot;Humanoid&amp;quot;)&lt;br /&gt;
  if h ~= nil then&lt;br /&gt;
    local b = Instance.new(&amp;quot;BodyPosition&amp;quot;)&lt;br /&gt;
    b.position = Vector3.new(500, 500, 500)&lt;br /&gt;
    b.maxForce = Vector3.new(500000000, 500000000, 500000000)&lt;br /&gt;
    b.Parent = hit.Parent.Torso&lt;br /&gt;
    wait(3)&lt;br /&gt;
    b.Parent = nil&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
script.Parent.Touched:connect(onTouched)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to change where the character flies to, then you can change the BodyPosition&amp;#039;s position property. Also, something really fun is if you only wait(0.1) then the character goes flying! &lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[[BodyPosition]]&lt;br /&gt;
&lt;br /&gt;
[[Vector3]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Tutorials]]&lt;/div&gt;</summary>
		<author><name>PRG</name></author>
	</entry>
</feed>