jegabert
|
  |
| Joined: 11 Mar 2009 |
| Total Posts: 3515 |
|
|
| 02 May 2013 02:04 PM |
I have a basic sword, When I press "Q" I want the the script in the sword to print "Boop"
So far I found this.
local tool = script.Parent tool.Selected:connect(function(mouse) mouse.KeyDown:connect(function(key) if key == "q" then print("BEEEP") end end) end)
But When I activate the took I get this:
Disconnected event because of exception Selected is not a valid member of Tool |
|
|
| Report Abuse |
|
|
jegabert
|
  |
| Joined: 11 Mar 2009 |
| Total Posts: 3515 |
|
|
| 02 May 2013 02:09 PM |
| I am stuck, I got most of that segment from the wiki. |
|
|
| Report Abuse |
|
|
btft
|
  |
| Joined: 19 Feb 2011 |
| Total Posts: 1512 |
|
|
| 02 May 2013 02:11 PM |
| That code only works in a local script in a hopperbin. |
|
|
| Report Abuse |
|
|
jegabert
|
  |
| Joined: 11 Mar 2009 |
| Total Posts: 3515 |
|
|
| 02 May 2013 02:12 PM |
| Is there an eqivelant to it for normal tools? |
|
|
| Report Abuse |
|
|
|
| 02 May 2013 02:13 PM |
Tool doesn't use "Selected"
It uses "Equipped"
For more information, check out the wiki page :D
http://wiki.roblox.com/index.php/RBX.lua.Tool_%28Object%29 |
|
|
| Report Abuse |
|
|
btft
|
  |
| Joined: 19 Feb 2011 |
| Total Posts: 1512 |
|
|
| 02 May 2013 02:14 PM |
Tool.Equipped:connect(function(mouse) mouse.KeyDown:connect(function(key) print(key) end) end) |
|
|
| Report Abuse |
|
|
jegabert
|
  |
| Joined: 11 Mar 2009 |
| Total Posts: 3515 |
|
|
| 02 May 2013 02:15 PM |
excellent! thank you. I have scripted a few things but never tools, I am not used to all of the syntax for tools. |
|
|
| Report Abuse |
|
|