function module.Clicked(V,s)if V then if V.Character and not V:FindFirstChild("\080\105\103\103\121")then local j if s:IsA("\077\111\100\101\108")then j=s.PrimaryPart.Position else j=s.Position end module.DropTools(V,game.Workspace.Map,j)print("\068\114\111\112\112\101\100 \075\101\121\104\097\110\100\108\101\115")if game.ServerStorage.Tools:FindFirstChild(s.Name)then local j=game.ServerStorage.Tools[s.Name]:Clone()j.Parent=V.Backpack V.Character.Humanoid:EquipTool(j)s:Destroy()print("\069\113\117\105\112\112\101\100 \116\104\101 \116\111\111\108")end end end end return module

function module.Clicked (plr, item)
    
    -- 1. Check is player exists (not nil) and player is not Piggy
    if plr then 
        if plr.Character and not plr:FindFirstChild("Piggy") then
            
            -- 2. Get the position of the part so we can swap parts
            -- models do not have position as a property, rather a PrimaryPart property which is generally the handle (some invisible part)
            
            local position
            if item:IsA("Model") then
                position = item.PrimaryPart.Position
            else
                position = item.Position
            end
            
            -- drop whatever is in the players backpack or equipped (if any)
            -- send in the player, the map and the position of the newly clicked item
            module.DropTools(plr, game.Workspace.Map, position)
            print ("Dropped Keyhandles")
            
            --3. Put a copy of the serverstorage item in the players backpack
            if game.ServerStorage.Tools:FindFirstChild(item.Name) then
                -- clone server copy
                local clonedTool = game.ServerStorage.Tools[item.Name]:Clone()
                
                -- put it in the players backpack
                clonedTool.Parent = plr.Backpack
                
                -- auto equip it
                plr.Character.Humanoid:EquipTool(clonedTool)
                
                -- destroy the part on the map
                item:Destroy()
                
                print ("Equipped the tool")
            end
            
        end        
    end
    
end

return module
