User:Buckethead101/Tools and HopperBins: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Buckethead101
>JulienDethurens
Nominated for deletion.
 
Line 1: Line 1:
= Introduction =
{{delete}}
What's a battle place without the weapons? What's a plane without the plane tool? What's a buildng place without any building tools? The answer to all those, is nothing. In this tutorial, you will learn to make some basic tools and weapons.
 
= Intro to HopperBins =
The easiest and most basic tool is a hopperbin. A hopperbin is a tool where you don't hold anything; your arm doesn't even come up. That's what plane and car tools are. It's what reset tools are. It's what (some) rock-trowing tools are. Hopperbins are used for many things.
 
== The Basic Functions ==
The basic functions for hopperins are:
*Button1Down - Makes something happen when you click.
*KeyDown - Makes something happen when you push a key on the keyboard.
*Selected - Makes something happen when the tool is selected
*Deselected - Makes something happen when the tool is deselected.
 
== Making a Reset Tool ==
 
=== Getting Started ===
Now that you know the basic functions, it's time to make a reset tool.
 
First Thhings first; In the explorer menu, select the starterpack in explorer, and go to Insert>Object.
 
 
[[Image:InsertObject.png|300px]]
 
 
Next, double-click on HopperBin.
 
 
[[Image:HopperBin.png|400px]]
 
Now, rename the hopperbin to "reset", select it, and go to Insert>Object again, but this time double-click on Script. Now, double-click the new script. It should say "print("Hello world!")" Delete that.
 
=== Making the Script ===
Now it's time to make the script. You will learn how to use the functions listed above.
 
First is the Button1Down function.
<pre>function onButton1Down(mouse) </pre>
Next we need to say what happens when the player clicks.
<pre>script.Parent.Parent.Parent.Character.Humanoid.Health = 0 -- kills the player
end </pre>
Now we ned to do the Selected function.
<pre>function onSelected(mouse)
mouse.Button1Down:connect(onButton1Down) -- the connection line for the Button1Down function
end </pre>
Finally, we need the connection for the Selected function.
<pre>script.Parent.Selected:connect(onSelected) </pre>
 
=== The Finished Script ===
<pre>function onButton1Down(mouse)
script.Parent.Parent.Parent.Character.Humanoid.Health = 0 -- kills the player
end
 
function onSelected(mouse)
mouse.Button1Down:connect(onButton1Down) -- the connection line for the Button1Down function
end
 
script.Parent.Selected:connect(onSelected) </pre>
 
= Intro to Tools =
A Tool is a tool where you '''do''' hold something in your hand. This is call the '''handle'''.
 
== Using Handles ==
Go to Insert>Object again, and click '''Tool'''. Now, select the tool, and go to Insert>Object, and click '''Script'''. Now select the tool again, and go to Insert>Object again, and click '''Part'''. Now, name the new part '''Handle'''. Spelling and capitalization '''must''' be correct. Finally, select '''Handle''' and using it's '''properties''', make it look how you want.
 
== Making the Tool ==
Now that you have a tool with a handle, we're going to make the tool do something. To keep it simple, we'll just make a tool that disapears for a few seconds when you click.
 
First things first- Tagging the player and the tool.
<pre>tool = script.Parent -- tagging the tool.
player = tool.Parent -- When tools are selected, they become a child of the character
                    -- Instead of the player. </pre>
Now, the function. Tools use the Activated function.
<pre> function onActivated() </pre>
Now, we need to make it disapear.
<pre>tool.Parent = nil
wait(3)
tool.Parent = player </pre>
Finally. let's end the function and write the connection line.
<pre>end
 
script.Parent.Activated:connect(onActivated) </pre>
 
=== The finished script ===
<pre>tool = script.Parent -- tagging the tool.
player = tool.Parent -- When tools are selected, they become a child of the character
                    -- Instead of the player.
function onActivated()
tool.Parent = nil
wait(3)
tool.Parent = player
end
 
script.Parent.Activated:connect(onActivated) </pre>
 
'''When I went to test this, for some odd reason it just closed roblox. So there you go- a roblox-closer!'''

Latest revision as of 22:55, 5 May 2012

This page has been nominated for deletion