Also how do I instantiate a gameobject near a player instead of right on him. How do I adjust the transform.position.z so its like instantiate away from the character like 5 spaces but randomly placed on the x axis so basically there is an area around the gameObject where it can be instantiated.
transform.position.z = transform.position.z + Random value (a few spaces from character)