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: handle:Destroy() Help Please

Previous Thread :: Next Thread 
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 11:54 AM
I'm trying to make a script that will drop a tool (Bomb) when you left click. I've asked for help with the left click thing and no ones helped me. Please help me with the script:


tool = Can Bomb High Yield--Do I need to put the tools name here?

function Drop()
--What comes here??? Please tell me.
handle:Destroy()
tool.Parent = workspace
end
mouse.Button1Down:connect(Drop)


What do I do to make the handle get destroyed when you left click???

Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 12:00 PM
Or would it need to be in a Local GUI script thingy? and look like this?


tool = Can Bomb High Yield--Do I need to put the tools name here?

enabled = true

function onButton1Down(mouse)

handle:Destroy()

tool.Parent = workspace

if not enabled then
return
end

enabled = false
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

wait(7)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
enabled = true

end

function onEquippedLocal(mouse)

if mouse == nil then
print("Mouse not found")
return
end

mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end


Tool.Equipped:connect(onEquippedLocal)

(/\ Tried that and nothing happens.)
Report Abuse
Scripbuilder900 is not online. Scripbuilder900
Joined: 04 Aug 2011
Total Posts: 183
03 Aug 2012 12:02 PM
You weren't far off.
tool = tools location --You'll have to figure out the path to the tool
handle = tool.handle
function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 12:06 PM
The tools location is Workspace, right? Or is it Player?? (I'm still new to scripting.)
Report Abuse
Scripbuilder900 is not online. Scripbuilder900
Joined: 04 Aug 2011
Total Posts: 183
03 Aug 2012 12:08 PM
No problem. The tool is in the player, and the best way to identify the player is use a local script and get the player that way.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 12:11 PM
So, the finished script would look like this?

tool = tools.Player.Backpack --<< Is that right?
handle = tool.handle
function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 12:35 PM
/\ is that right???
Report Abuse
BrandonFireflower is not online. BrandonFireflower
Joined: 09 Feb 2010
Total Posts: 731
03 Aug 2012 12:59 PM
The best way would be using script.Parent, which is usually the tool. You know how to use script.Parent, right?

If not I'll explain.

--BrandonFireflower, LuaLearners Writer and president of the Exodus Task Force.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:20 PM
tool = script.Parent --<< This is correct
handle = tool.handle
function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:21 PM
ops, one more error:

tool = script.Parent
handle = tool.Handle
function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:22 PM
@Brand, I'm not 100% for sure what it is.

@Cheat, thanks.

So i just put the script into a local GUI script and it'll work? Or does it still need something?
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:24 PM
only put it directly into the tool
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:26 PM
Like this: http://www.roblox.com/Can-Bomb-High-Yield-item?id=88845168

Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:28 PM
Wait.. Just tested it.. -_- nothing happens again :/

Am I missing something or what?
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:29 PM
yes you have did something wrong.
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:29 PM
you have to use the event Equipped to get the mouse
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:31 PM
read on this site to find out how it works:
http://wiki.roblox.com/index.php/Equipped
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:31 PM
Oh. fixed version I think:


tool = script.Parent
handle = tool.Handle


function onEquippedLocal(mouse)

function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)

if mouse == nil then
print("Mouse not found")
return
end

mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end


Tool.Equipped:connect(onEquippedLocal)

function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
03 Aug 2012 01:33 PM
this is more correct:

tool = script.Parent
handle = tool.Handle


function onEquippedLocal(mouse)

function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)

if mouse == nil then
print("Mouse not found")
return
end

mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end


Tool.Equipped:connect(onEquippedLocal)
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:34 PM
@ cheat didn't see that till now.

okay so, in this:

local function onEquipped(mouse)
mouse.KeyDown:connect(onKeyDown)
mouse.Button1Down.connect(function() onButton1Down(mouse) end)
end
tool.Equipped:connect(onEquipped)

where do I put my function at? please put a " --here " in where my function goes.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:35 PM
oh
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
03 Aug 2012 01:38 PM
If you want it to come back you need to clone it.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
03 Aug 2012 01:38 PM
Script didn't work.

Lemme try this:

tool = script.Parent
handle = tool.Handle


local function onEquipped(mouse)
function Drop()
handle:Destroy()
tool.Parent = game.Workspace
end
mouse.Button1Down:connect(Drop)


mouse.Button1Down.connect(function() onButton1Down(mouse) end)
end
tool.Equipped:connect(onEquipped)
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