User:Buckethead101/Tools and HopperBins: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Buckethead101
No edit summary
>Buckethead101
No edit summary
Line 13: Line 13:


== Making a Reset Tool ==
== Making a Reset Tool ==
=== Getting Started ===
Now that you know the basic functions, it's time to make a reset tool.
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>HopperBin.
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


[[Image:InsertObject.png]]
script.Parent.Selected:connect(onSelected) </pre>

Revision as of 03:40, 1 January 2009

Introduction

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.



Next, double-click on HopperBin.


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.

function onButton1Down(mouse) 

Next we need to say what happens when the player clicks.

script.Parent.Parent.Parent.Character.Humanoid.Health = 0 -- kills the player
end 

Now we ned to do the Selected function.

function onSelected(mouse) 
mouse.Button1Down:connect(onButton1Down) -- the connection line for the Button1Down function
end 

Finally, we need the connection for the Selected function.

script.Parent.Selected:connect(onSelected) 

The Finished Script

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)