Do you have any more PED except that one in the resource? If NO then you can modify it to : 
addEventHandler ( 'onClientClick',root, 
    function ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
        if  ( clickedElement ) and ( getElementType ( clickedElement )  == 'ped' ) then 
            for _,ped in ipairs ( getElementsByType ( 'ped',resourceRoot ) ) do 
                if  ( clickedElement == ped ) then 
                    if ( guiGetVisible ( GUIEditor.window[1] ) == false ) then 
                        guiSetVisible ( GUIEditor.window[1],true ) 
                    end 
                end 
            end 
        end 
    end 
) 
                
bindKey ( 'm','down', 
    function (      ) 
        showCursor ( not isCursorShowing (      )   ) 
    end 
) 
 
And it should work as well .