local Player = game.Players.LocalPlayer local Button = script.Parent Button.MouseButton1Click:Connect(function() Player.Backpack:ClearAllChildren() Player.StarterGear:ClearAllChildren() end)
I am able to clear Backpack and StarterGear, but when you respawn the items reappear in your inventory. I believe it is because it saves in your StarterGear but I may be incorrect.
If my answer helped, please approve it!~
Initialize the variables,
local Player = game.Players.LocalPlayer local Button = script.Parent
Put in the function,
Button.MouseButton1Click:Connect(function() end)
Loop through all the items in their backpack
for _, Tool in pairs(Player.Backpack:GetChildren()) do if Tool:IsA("Tool") then Tool:Destroy() end end
Do the same for their StarterGear
for _, Tool in pairs(Player.StarterGear:GetChildren()) do if Tool:IsA("Tool") then Tool:Destroy() end end
All together should be:
local Player = game.Players.LocalPlayer local Button = script.Parent Button.MouseButton1Click:Connect(function() for _, Tool in pairs(Player.Backpack:GetChildren()) do if Tool:IsA("Tool") then Tool:Destroy() end end for _, Tool in pairs(Player.StarterGear:GetChildren()) do if Tool:IsA("Tool") then Tool:Destroy() end end end)
If I messed something up let me know because I'm very prone to that :P