|
| 07 Mar 2012 03:56 PM |
| How would i get the name of the brick on which you clicked on while using a tool? |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:00 PM |
mouse.Target
Gets what ever part the mouse is moved over. To get the name it'd be mouse.Target.Name
Can be implemented into the Left click function of your tool. |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:06 PM |
How do i use the left click finction? Im new to using tools. |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:10 PM |
function onButton1Down(mouse) if mouse.Target ~= nil then --Checks that there's an actual target print(mouse.Target.Name) --print the targets name end end
function onEquipped(mouse) mouse.Button1Down.connect(function() onButton1Down(mouse) end) end
tool.Equipped:connect(onEquipped) |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:15 PM |
I got an error. Script: function onButton1Down(mouse) if mouse.Target ~= nil then print(mouse.Target.Name) if mouse.Target.Parent.Name == "SpleefBlox" then mouse.Target.CanCollide = false mouse.Target.Anchored = false end end end
function onEquipped(mouse) mouse.Button1Down.connect(function() onButton1Down(mouse) end) end
script.Parent.Equipped:connect(onEquipped)
Error: Equipped is not a valid member of HopperBin Script "Players.Player.Backpack.HopperBin.Script", Line 27 |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:17 PM |
oic hopperbin.
function onButton1Down(mouse) if mouse.Target ~= nil then print(mouse.Target.Name) if mouse.Target.Parent.Name == "SpleefBlox" then mouse.Target.CanCollide = false mouse.Target.Anchored = false end end end
function onSelected(mouse) mouse.Button1Down.connect(function() onButton1Down(mouse) end) end
script.Parent.Selected:connect(onSelected) |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:20 PM |
Used your lsat script and got this error: Players.Player.Backpack.HopperBin.Script:22: bad argument #1 to 'connect' (RBXScriptSignal expected, got function) |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:30 PM |
^^ wait nevermind i fixed it... |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2012 04:32 PM |
How come when i click nothing happens? And theres no output.
Script:
function onButton1Down(mouse) if mouse.Target ~= nil then m = Instance.new("Message",Workspace) m.Text = mouse.Target.Name if mouse.Target.Parent.Name == "SpleefBlox" then mouse.Target.CanCollide = false mouse.Target.Anchored = false end end end
function onSelected(mouse) mouse.Button1Down:connect(function() onButton1Down(mouse) end) end
|
|
|
| Report Abuse |
|
|