local v=game:GetService("\080\108\097\121\101\114\115")local m={}function m.AddOnClick(v,m)local u=function(v)if not v.Backpack:FindFirstChild(m.Name)then local u=m:Clone()u.Parent=v.Backpack end end return v.MouseClick:Connect(u)end function m.RemoveOnTouched(m,u)local q=function(m)if m.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")~=nil then local q=v:FindFirstChild(m.Parent.Name)if q~=nil then local v=q.Backpack:GetChildren()for v,m in pairs(v)do if m.Name==u then m:Remove()end end end end wait(.2)end return m.Touched:Connect(q)end return m
local PlayersService = game:GetService("Players")

local module = {

}

--Dont mess with any of this
function module.AddOnClick(clickDetector, toolInstance)
    local clickHandler = function(playerThatClicked)
        if not playerThatClicked.Backpack:FindFirstChild(toolInstance.Name) then
            local clonedTool = toolInstance:Clone()
            clonedTool.Parent = playerThatClicked.Backpack
        end
    end

    return clickDetector.MouseClick:Connect(clickHandler)
end

function module.RemoveOnTouched(partToTouch, toolName)
    local touchedHandler = function (obj)
        if obj.Parent:FindFirstChild("Humanoid")~=nil then
            local foundPlayer = PlayersService:FindFirstChild(obj.Parent.Name)
            if foundPlayer ~= nil then
                local backpackContents =foundPlayer.Backpack:GetChildren()
                for _, item in pairs(backpackContents) do
                    if item.Name == toolName then
                        item:Remove()
                    end
                end
            end
        end
        wait(0.2)
    end

    return partToTouch.Touched:Connect(touchedHandler)
end

return module