|
| 13 Jul 2014 12:14 AM |
| How would i do this im trying to make a script that has a table of 5 tools names in it from backpack then below theirs a clear all the tools even if all the tools are not there it still removes which tools are there i have no clue on how to do so, |
|
|
| Report Abuse |
|
|
cornytime
|
  |
| Joined: 07 Feb 2013 |
| Total Posts: 3213 |
|
|
| 13 Jul 2014 12:16 AM |
| game.Players.PlayerName.Backpack:ClearAllChildren() |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:21 AM |
| i dont want to clear all children i need only the list of 5 , |
|
|
| Report Abuse |
|
|
6PenTax
|
  |
| Joined: 01 Sep 2010 |
| Total Posts: 178 |
|
|
| 13 Jul 2014 12:22 AM |
I don't understand the way you're expressing yourself.
Do you want to delete there 5 certain tools only? Or the opposite? |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:25 AM |
| i only want to delete the tools out of the 5 tools not any of the rest. |
|
|
| Report Abuse |
|
|
6PenTax
|
  |
| Joined: 01 Sep 2010 |
| Total Posts: 178 |
|
|
| 13 Jul 2014 12:31 AM |
Got it, here.
local player=Game.Players.LocalPlayer (Obviously a localscript) local Tools={"Tool1","Tool2","Tool3","Tool4","Tool5"}
for _,v in pairs(player:WaitForChild("Backpack") do for i=1,#Tools do if v.Name:lower()==Tools[i]:lower() then v:Destroy() end end end |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:35 AM |
this is underlined red
for _,v in pairs(player:WaitForChild("Backpack") do |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:36 AM |
ToolsToBeRemoved = {1,2,3,4,5} for _,v in pairs(game.Players:GetChildren()) do for _,i in pairs(ToolsToBeRemoved) do if v.Backpack:FindFirstChild(i.Name) then v.Backpack:FindFirstChild(i.Name):Remove() end end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Jul 2014 12:39 AM |
this doesnt work :<
local player=Game.Players.LocalPlayer local Tools={"Tool1","Tool2","Tool3","Tool4","Tool5"} while wait(.1) do for _,v in pairs(player:WaitForChild("Backpack")) do for i=1,#Tools do if v.Name:lower()==Tools[i]:lower() then v:Destroy() end end end end
|
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:41 AM |
> AnonyAnonymous
it wont work. |
|
|
| Report Abuse |
|
|
6PenTax
|
  |
| Joined: 01 Sep 2010 |
| Total Posts: 178 |
|
|
| 13 Jul 2014 12:45 AM |
| ._. It's the method I use for my tools, how can't it work? it's technically like saying if tool.classname="potato" then tool:destroy() end |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:48 AM |
| try it in studio is in in starter pack mine was in starter gui |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 12:49 AM |
| also im not removing tool's im removing local script's key down function's. |
|
|
| Report Abuse |
|
|
| |
|
| |
|