Take the gun out of the hoster. Shake the gun . Then shake the holster. That should isolate the source of the click .
If the click is in the gun, unload it and shake the loaded magazine. Unload the magazine and shake the gun and mag again to see if the loaded condition makes any difference .
If you don't figure it out that way, field strip and check for a broken slide lock or other part, such as a spring . If you know how, completely disassemble the gun and check every part . If not, you may wish to have a gunsmith or armorer do that .
Reassemble and function check the gun . Take it to the range and fire it. See if the noise changes after firing it several times .
Here is a link to a video on Glock disassembly. There are others . You may find written instructions with a Google search . AGI's DVD , " Making Glocks Rock " covers it completely .
http://www.flixya.com/video/605942/Glock_disassembly