Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a gui button that clears your inventory, I've tried so much?

Please be more describing, I'm quite new to lua/

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.