(first off, use code blocks and more depth into your question next time)
i tested it, and it works fine, until you do so while HOLDING a tool, the reason for this is because whenever a tool is being held, its moved out of the backpack, and into the character, so be sure to deal with that too
also :connect() is depracted, use :Connect()
same for :remove(), use :Destroy()
function Touch(hit)
if hit and h.Parent and hit.Parent:FindFirstChildOfClass("Humanoid") then
game.Players[h.Parent.Name].Backpack:ClearAllChildren()
local CharTool = FindFirstChildOfClass(_HopperBin_) or h.Parent_FindFirstChildOfClass(_Tool_)
if CharTool then
CharTool:Destroy()
end
end
end
script.Parent.Touched:Connect(Touch)
1 comment
don't get a random script from the internet, please post your broken script