How to make a Trampoline: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker (OK, that works) |
>Davidii m (→Script) |
||
Line 14: | Line 14: | ||
<pre> | <pre> | ||
local v = 200 | |||
function onTouched(part) -- when the brick gets touched | function onTouched(part) -- when the brick gets touched | ||
if part.Parent ~= nil then -- if it's human | if part.Parent ~= nil then -- if it's human | ||
Line 19: | Line 20: | ||
if h~=nil then | if h~=nil then | ||
h.Parent.Torso.Velocity=Vector3.new(0, | h.Parent.Torso.Velocity=Vector3.new(0,v,0) -- shoot your humanoid in the air at v speed | ||
wait(0.5) -- wait this long | wait(0.5) -- wait this long | ||
end | end | ||
Line 27: | Line 28: | ||
</pre> | </pre> | ||
This script was taken right from the trampoline model. | This script was taken right from the trampoline model. If you want to change how fast you go, chang the variable '''V'''. | ||
The problem with this is that if you make your entire trampoline with this script, the trampoline will bounce equally high in the middle as on the outer edge. This isn't representative of real life. So, what you can do is make the trampoline bricks in the middle bounce a little higher (the 'sweet spot') than on the outer edges to make it a little more realistic. | The problem with this is that if you make your entire trampoline with this script, the trampoline will bounce equally high in the middle as on the outer edge. This isn't representative of real life. So, what you can do is make the trampoline bricks in the middle bounce a little higher (the 'sweet spot') than on the outer edges to make it a little more realistic. | ||
Revision as of 09:39, 29 September 2008
Introduction
This tutorial is intended to show how to build a trampoline.
Setup
Let's begin by adding one brick. Now, you'll want to look in your properties, and if you don't have the properties window, then select View->Properties.
Script
- Select the brick.
- Insert > Object > Script.
- Copy and Paste the following into the script object:
local v = 200 function onTouched(part) -- when the brick gets touched if part.Parent ~= nil then -- if it's human local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.Parent.Torso.Velocity=Vector3.new(0,v,0) -- shoot your humanoid in the air at v speed wait(0.5) -- wait this long end end end script.Parent.Touched:connect(onTouched)
This script was taken right from the trampoline model. If you want to change how fast you go, chang the variable V. The problem with this is that if you make your entire trampoline with this script, the trampoline will bounce equally high in the middle as on the outer edge. This isn't representative of real life. So, what you can do is make the trampoline bricks in the middle bounce a little higher (the 'sweet spot') than on the outer edges to make it a little more realistic.
Alternative methods
- Insert > Object > Part
- Move the newly created brick where you want it to be.
- Anchor this brick. (This is important).
- Select this brick.
- In the Properties window, click the "+" next to Velocity.
- Change the "y" Value between 0-300. NOTE:If it goes over 500 your body might disappear.
- Test your map. When you walk on top of the brick, you will shoot into the air.