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 |
|
|
|
| 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
|
  |
| Joined: 09 Jun 2011 |
| Total Posts: 5966 |
|
|
| 05 Nov 2011 02:05 AM |
| You mean the Touched event? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 05 Nov 2011 03:03 AM |
| then also check it in backpack then |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 05 Nov 2011 03:45 AM |
| Add a wait() to your loop, and not in the 'white wait() do' line. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 05 Nov 2011 04:34 AM |
Tool.Unequipped:connect(function() if Tool.Parent == workspace then -- PUT YER STUFF HER. end end) |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 09 Jun 2011 |
| Total Posts: 5966 |
|
| |
|
| |
|
eJorge
|
  |
| Joined: 09 Jun 2011 |
| Total Posts: 5966 |
|
| |
|