how do i make weapon spawn from a random spot

im making a multiplayer fighting game and i wanna know how to make weapons appear from anywhere so my fighers can pick them up and use them on eachother

Here is a simple approach

var pos : Vector3;
pos.x = Random.Range(0, Terrain.activeTerrain.heightmapwidth);
pos.z = Random.Range(0, Terrain.activeTerrain.heightmapheight);
pos.y = Terrain.activeTerrain.SampleHeight(pos);
Instantiate(Weapon,  pos, Quaternion.identity);

Hope this helps (Not tested might have minor typos) Vinpasso

You can make a prefab out of the weapons you can instantiate a prefab like this: This will copy your weapon every time you click the left button on the mouse.

var weapon : Rigidbody;

function Update () {

if (Input.GetButtonDown("Fire1")) {

var clone : Rigidbody;

clone = Instantiate(weapon, transform.position, transform.rotation);

Check this codes:

What I've done is create a 'spawn point' prefab (with its own gizmo), which you can then place around your scene where things could be legitimately spawned in. Then when you're ready for one, pick one of those spawn objects at random and use it's transform.position. You can use tags and layers and such to manage them and spawn different types of things on different points.