Please be more describing, I'm quite new to lua/
Put this inside your button:
local Button = script.Parent Button.MouseButton1Down:Connect(function() -- Detect when the player click the button game.ReplicatedStorage.ClearInventory:FireServer() end)
now create a new RemoteEvent in ReplicatedStorage and name it "ClearInventory"
now put this inside ServerScriptStorage:
game.ReplicatedStorage.ClearInventory.OnServerEvent:Connect(function(player) -- Detect when a player fire the RemoteEvent for _,i in pairs(player.Backpack:GetChildren()) do -- Loop inside the player's inventory i:Destroy() -- Destroy the item end end)