mr620r
|
  |
| Joined: 19 Aug 2010 |
| Total Posts: 31 |
|
|
| 06 Sep 2011 12:35 PM |
I am trying to make a hopper bin that will make one brick and then delete/remove itself. I was able to find a script that added a brick but not one that removed the hopper bin after it was used. I tried using this one:
function onButton1Down(mouse) script.Parent.Parent:Remove() end
but it did not work. If someone could point me in the right direction, the wiki did not help me with this, I would be very appreciative.
Again I am looking for a script that removes a tool hopper bin after it has been used once. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 06 Sep 2011 02:37 PM |
I am not too good with hopperbins, yet.. How is this?
function onButton1Down(mouse) script.Parent.Parent:Remove() end
function onSelected(mouse) mouse.Button1Down:connect(onButton1Down) end
script.Parent.Selected:connect(onSelected) |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 06 Sep 2011 02:38 PM |
| you forgot Selected Event xD Not grim! |
|
|
| Report Abuse |
|
|
mr620r
|
  |
| Joined: 19 Aug 2010 |
| Total Posts: 31 |
|
|
| 06 Sep 2011 07:23 PM |
| Thank you for the feedback. I tested out the script but it didn't really do anything other then not let me reselect the tool. |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2011 07:25 PM |
local times = 0
script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(function() times = times + 1 if times > 1 then return end --code on first use end end) end)
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
mr620r
|
  |
| Joined: 19 Aug 2010 |
| Total Posts: 31 |
|
|
| 07 Sep 2011 01:09 PM |
| @electricblaze, I tried using that in a stand alone script and it didn't work. Did you mean that I should add to my existing script? |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
| |
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 07 Sep 2011 05:54 PM |
function onButton1Down(mouse) script.Parent:Remove() end
function onSelected(mouse) mouse.Button1Down:connect(onButton1Down) end
script.Parent.Selected:connect(onSelected)
How about that one? :o |
|
|
| Report Abuse |
|
|
Zarcius
|
  |
| Joined: 08 Dec 2007 |
| Total Posts: 3024 |
|
|
| 07 Sep 2011 05:56 PM |
@Thread creator
ElectricBlaze's script will work, but you must add your part of the script in place of the commented line. |
|
|
| Report Abuse |
|
|
mr620r
|
  |
| Joined: 19 Aug 2010 |
| Total Posts: 31 |
|
|
| 08 Sep 2011 06:41 AM |
Thank you guys so much for all of your help. Ultimately Grim's script worked, I just had to add a slight delay so that the hopper bin's main script would work before it was deleted.
print(Wait(1)) function onButton1Down(mouse) script.Parent:Remove() end
function onSelected(mouse) mouse.Button1Down:connect(onButton1Down) end
script.Parent.Selected:connect(onSelected) |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 08 Sep 2011 10:07 AM |
Try this:
script.Parent.Selected:connect( script.Parent.MouseButton1Click:connect(function() p = instance.new("part", workspace) p.Name = "Part" script.Parent.Selected = false script.Parent:Remove() end) ) |
|
|
| Report Abuse |
|
|