Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to I remove a tool from both the players backpack and their character?

Asked by
7Woofy 0
2 years ago
Edited 2 years ago

So I Have a text button that removes the tool from their backpack when its not equipped, but when it is it's not in their backpack it's in their character. How do I grab it and delete it there?

script.Parent.Visible = false
local p = game.Players.LocalPlayer
local items = p.Backpack:FindFirstChildOfClass("Tool")
local activated = false
local guy = game.Players.LocalPlayer.Character


script.Parent.MouseButton1Click:connect(function()
    local tool = game.Players.LocalPlayer.Backpack:GetChildren()
    script.Parent.Parent.Popcatsword.Visible = true
    script.Parent.Parent.TextButton.Visible = true
    script.Parent.Parent.shrek.Visible = true
    script.Parent.Parent.bow.Visible = true
    for i, tool in ipairs(game.Players.LocalPlayer.Backpack) do
        tool:Destroy()
    end
    for i,item in pairs(guy:GetChildren()) do
        if item:IsA("Tool") then
            item:Destroy()
        end
    end
end)

Note: this is in a Local Script.

Answer this question