generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Tool Help

Previous Thread :: Next Thread 
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
07 Mar 2012 04:06 PM
How do i use the left click finction?
Im new to using tools.
Report Abuse
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
WhoBloxedWho is not online. WhoBloxedWho
Joined: 25 Mar 2009
Total Posts: 4611
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
07 Mar 2012 04:30 PM
^^
wait nevermind i fixed it...
Report Abuse
unholysoda is not online. unholysoda
Joined: 15 May 2010
Total Posts: 9024
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image