|
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, |
|
cornytimeJoin Date: 2013-02-07 Post Count: 3213 |
game.Players.PlayerName.Backpack:ClearAllChildren() |
|
|
i dont want to clear all children i need only the list of 5 , |
|
NymintJoin Date: 2010-09-01 Post Count: 203 |
I don't understand the way you're expressing yourself.
Do you want to delete there 5 certain tools only?
Or the opposite? |
|
|
i only want to delete the tools out of the 5 tools not any of the rest. |
|
NymintJoin Date: 2010-09-01 Post Count: 203 |
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 |
|
|
this is underlined red
for _,v in pairs(player:WaitForChild("Backpack") do |
|
|
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 |
|
|
|
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
|
|
|
> AnonyAnonymous
it wont work. |
|
NymintJoin Date: 2010-09-01 Post Count: 203 |
._. 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 |
|
|
try it in studio is in in starter pack mine was in starter gui |
|
|
also im not removing tool's im removing local script's key down function's. |
|
|
|