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: How could I do a "Dropped" event?

Previous Thread :: Next Thread 
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
04 Nov 2011 02:54 PM
I want to happen something when you drop a tool. Is there any way?
Report Abuse
Nikolas5411 is not online. Nikolas5411
Joined: 03 Apr 2010
Total Posts: 2117
04 Nov 2011 02:57 PM
Well, all your really doing is dropping, then the touchplayerevent will active what ever you put in your code. Erm, script. :)
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 02:05 AM
You mean the Touched event?
Report Abuse
qwerty1806 is not online. qwerty1806
Joined: 20 Sep 2008
Total Posts: 737
05 Nov 2011 02:33 AM
You could check if the tool is in a Player, then when it is not do something.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 02:41 AM
Yeah, I thought about that. I was asking for a "Dropped" event, but there's no such thing... so let's try this script:

while wait() do
if script.Parent = workspace then break end
end
script.Parent.Handle.Name = "Bag"
script.Parent.Handle.Parent = workspace
script.Parent:remove()

Would that work? Or would it crash the game? Because that happened to me when I try to change parents.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 02:42 AM
while wait() do
if script.Parent.Parent == workspace then break end
end
script.Parent.Handle.Name = "Bag"
script.Parent.Handle.Parent = workspace
script.Parent:remove()

Fixed.
Report Abuse
UttermostExedra is not online. UttermostExedra
Joined: 28 Dec 2009
Total Posts: 2483
05 Nov 2011 02:43 AM
workspace.CHARACTER.ChildRemoved:connect(function(child)
if child.Name == "NAME OF THE TOOL" then
--DO STUFF
end
end)
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 03:00 AM
Yeah, but that would trigger when you unequip a tool...
Report Abuse
AngryTroIl is not online. AngryTroIl
Joined: 02 Nov 2011
Total Posts: 49
05 Nov 2011 03:03 AM
then also check it in backpack then
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 03:11 AM
Woah, I think I'm going to do this in another way xD
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 03:28 AM
Hm... I have another problem now. When I try to remove the tool from a script, the game crashes...
Report Abuse
qwerty1806 is not online. qwerty1806
Joined: 20 Sep 2008
Total Posts: 737
05 Nov 2011 03:45 AM
Add a wait() to your loop, and not in the 'white wait() do' line.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 04:18 AM
This is the script (no loops):

script.Parent.Equipped:connect(function(mouse)
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
local bag = script.Parent.Handle:clone()
bag.Name = "Bag"
bag.CanCollide = true
bag.CFrame = script.Parent.Handle.CFrame
bag.Parent = workspace
script.Parent:remove()
end)
end)

The problem is clearly the "script.Parent:remove()" chunk. How can I remove a tool without crashing?
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
05 Nov 2011 04:34 AM
Tool.Unequipped:connect(function()
if Tool.Parent == workspace then
-- PUT YER STUFF HER.
end
end)
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 07:26 AM
Cool, but now I'm asking for a way to remove the tool without crashing the game.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
05 Nov 2011 09:51 AM
Is there any way?
Report Abuse
GREATMARINE is not online. GREATMARINE
Joined: 22 Jul 2010
Total Posts: 106
05 Nov 2011 09:52 AM
bump.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
06 Nov 2011 06:42 AM
Bump (lol)
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