I am working on a game and the button that I have uses this code To remove a single tool
local plr = game:GetService('Players').LocalPlayer plr.Backpack:FindFirstChildWhichIsA('Tool'):Destroy()
I was wondering if I could expand on this and make it to were it would delete ALL tools in the starter pack. Thanks
This is probably what you are searching for:
local plr = game:GetService('Players').LocalPlayer local backpack = plr:WaitForChild("Backpack") for i, v in pairs(backpack:GetChildren()) do if v:IsA("Tool") then v:Destroy() end end
Hope this helped!
I forgot to mention I was going to add it into this code Its probably going to be hard so any help will be appreciated...
local cooldown = false --//r local button = script.Parent local plr = game:GetService('Players').LocalPlayer local tool = game.ReplicatedStorage.ACS_Engine.HOOD["Micro UZI"] button.Activated:Connect(function() if cooldown == false then cooldown = true script.Parent.Parent.Visible = false plr.Backpack:FindFirstChildWhichIsA('Tool'):Destroy() local clone = tool clone.Parent = plr.Backpack wait(0.5) script.Parent.Parent.Parent.ClassH.Visible = true wait(3) script.Parent.Parent.Parent.ClassH.Visible = false cooldown = false end end)
I am going to replace
plr.Backpack:FindFirstChildWhichIsA('Tool'):Destroy()