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: One use hopper bin

Previous Thread :: Next Thread 
mr620r is not online. 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 is not online. 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 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
06 Sep 2011 02:38 PM
you forgot Selected Event xD Not grim!
Report Abuse
mr620r is not online. 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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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 is not online. 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 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
07 Sep 2011 04:14 PM
post the script...
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
07 Sep 2011 05:54 PM
He did..
Report Abuse
grimm343 is not online. 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 is not online. 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 is not online. 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 is not online. 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
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