I need to have a trash can, that when you click it, it removes your tools from your inventory. This is what I have so far. Can anyone assist?
function onClicked() local human = onClicked.Parent:findFirstChild("Humanoid") if (human ~= nil) then onClicked().Parent.Name h = game.Players:findFirstChild(g).Backpack:getChildren() for i=1, #h do h[i]:remove() end end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Put this script in the Model
script.Parent.MouseClick:Connect(function(plr) for _, tool in pairs(plr.Backpack:GetChildren()) do tool:Destroy() end end)
This should fix it.
Best of luck developer