Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 04:57 PM |
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) children = player:GetChildren() for _,v in pairs(children) do if v:IsA("Tool") then v:Destroy() end end end end)
I put it in a brick, and touching the brick is supposed to remove any tools in your inventory. It doesn't work, however. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 04:58 PM |
children = player:GetChildren()
change that to
children = player.Backpack:GetChildren() |
|
|
| Report Abuse |
|
|
Vuva
|
  |
| Joined: 22 Jan 2010 |
| Total Posts: 1102 |
|
|
| 19 Jun 2014 04:59 PM |
| You also have to look for tools in the player's character model too, because when they equip a tool it moves to their character model. |
|
|
| Report Abuse |
|
|
ManMinded
|
  |
| Joined: 07 Oct 2012 |
| Total Posts: 618 |
|
|
| 19 Jun 2014 04:59 PM |
children = game.Players.LocalPlayer children.Backpack:ClearAllChildren()
Instead of GetChildren, just clear all children is the localplayers backpack ontouch |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:02 PM |
| @ManMinded: Unless things other than Tools are stored there. |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 05:05 PM |
| Yeah I have some scripts in there I don't want to get rid of. |
|
|
| Report Abuse |
|
|
| |
|
ManMinded
|
  |
| Joined: 07 Oct 2012 |
| Total Posts: 618 |
|
|
| 19 Jun 2014 05:06 PM |
put a script that gives you the tools that you need/lost after it e.e |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:07 PM |
@ManMinded That would be more resource-consuming than the method he is using. |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 05:11 PM |
@ManMinded: Yeah, too complex, it would be far easier just to remove the tools right off the bat and keep the scripts.
@Destroyer, I switched the lines but no dice. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 05:15 PM |
script.Parent.Touched:connect(function(Touch) if Touch.Parent:FindFirstChild("Humanoid") ~= nil then Player = game.Workspace:GetPlayerFromCharacter(Touch.Parent) for _,v in pairs(Player.Backpack:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end end end)
I fixed it up for you. Try that.
(make sure the script is a child of the part) |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 05:27 PM |
| still nothing. I looked while testing and the tool is in the player rather than the backpack, maybe that's why. |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
| |
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 05:38 PM |
| I can't seem to get this to work. |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
| |
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
| |
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 06:07 PM |
| I'm trying free models, it's not working. |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 06:09 PM |
| I hope this isn't a new roblox problem or anything. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:10 PM |
| Why did you put Tools in the Player..? |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 06:12 PM |
| I didn't put the tools in player. What's happening is that there's a tool lying on the ground, and when you pick it up it goes into player for some reason instead of the backpack. It's not a script I made. |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:13 PM |
Oh, the CHARACTER, not the Player object?
Yeah, unequip tools first.
script.Parent.Touched:connect(function(Touch) if Touch.Parent:FindFirstChild("Humanoid") ~= nil then Player = game.Workspace:GetPlayerFromCharacter(Touch.Parent) Player.Character.Humanoid:UnequipTools() for _,v in pairs(Player.Backpack:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end end end) |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 06:19 PM |
Still doesn't seem to work for some reason.
Can anyone test this seperately and see if it works for them? |
|
|
| Report Abuse |
|
|
|
| 19 Jun 2014 06:20 PM |
script.Parent.Touched:connect(function(Touch) if Touch.Parent:FindFirstChild("Humanoid") ~= nil then Player = game.Workspace:GetPlayerFromCharacter(Touch.Parent) for _,v in pairs(Player.Character:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end for _,v in pairs(Player.Backpack:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end end end) |
|
|
| Report Abuse |
|
|
Zerio920
|
  |
| Joined: 06 Apr 2012 |
| Total Posts: 3311 |
|
|
| 19 Jun 2014 06:23 PM |
| Still nothing. Gah this is infuriating. And this is basically the last script I need too. |
|
|
| Report Abuse |
|
|
| |
|