so this is inside a button that clears your inventory.
script.Parent.Visible = false local p = game.Players.LocalPlayer local items = p.Backpack:FindFirstChildOfClass("Tool") local activated = false 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, child in ipairs(tool) do child:Activate() child:Deactivate() child:Destroy() end script.Parent.Visible = false end)
I was a little confused by your post title, but if you're looking for a button that clears your inventory then this would do it:
script.Parent.MouseButton1Click:connect(function() for _, tool in ipairs(game.Players.LocalPlayer.Backpack) do if Tool:IsA("Tool") then Tool:Destroy() end end end)
You can add any of the visibility settings you had as needed.
I'm not entirely sure what you were trying to accomplish with activating and deactivating the tool. If that was your intent, let me know and I can try to help.