Problem with spawn object

Edit: SOLVED

İ found a spawn script but i couldn’t do at different position. i using camera follow script. i mean first object will spawn 0,0,0 second object will spawn 20,0,0. how can do it??

code is here:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(BoxCollider2D))]
public class SpawnArea : MonoBehaviour {
    public GameObject spawnedPrefab;
    BoxCollider2D spawnArea;
    Vector2 maxSpawnPos;

    float lastSpawnTimeS = -1;
    public float spawnDelayS = 5;

    // Use this for initialization
    void Start () {
        spawnArea = GetComponent<BoxCollider2D>();
        spawnArea.enabled = false; //We don't need this to test for any collisions, just to show visual bounds info in the editor.
        maxSpawnPos = new Vector2(spawnArea.size.x / 2, spawnArea.size.y / 2);
    }
 
    // Update is called once per frame
    void Update () {
        if (lastSpawnTimeS < 0) {
            lastSpawnTimeS = Time.time;
            print ("spawn timer fire");
            GameObject spawned = Instantiate(spawnedPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            spawned.transform.parent = transform;
            Vector3 pos = new Vector3(Random.Range(-maxSpawnPos.x, maxSpawnPos.x), Random.Range(-maxSpawnPos.y, maxSpawnPos.y), 0);
            spawned.transform.localPosition = pos;
        } else if (lastSpawnTimeS >= 0 && Time.time - lastSpawnTimeS > spawnDelayS) {
            lastSpawnTimeS = -1;
        }
    }
}

please help

c’mooonnn i need help.

What have you tried changing in the script & what happened when you changed it?

i didn’t change it. just i found this script and applied but it spawning too close each other. i want to the rope will spawn given distance. each rope between 10 px

It’s best to try doing the scripting yourself before asking people to change other people’s scripts that you got or to just write scripts for you. I’d suggest working through these tutorials as they will explain how to spawn items & a lot of other things.
If you want to spawn more than one rope there will be a number of options, each better for different scenarios on what else you are wanting to do in the game.

https://unity3d.com/learn/tutorials

you think i didn’t try or do this?? i looked up all tutorials and i wrote many scripts but nothing worked. always same problem. because i using rope system and i working for weeks. anyway i try to get help my programmer friends or teachers. There’s nothing I can do.

That’s fine but you didn’t say that. You said you found the script. I asked what you had tried & you said you hadn’t changed it & that you had just found it. Anyway, definitely ask your teachers as they will be able to sit down with all your scripts & work through it & immediately see each impact.

i found only this script but i couldn’t change it. because code structure is broking. the script is ok just i can’t give each distance. the ropes will spawn given distance like flappy bird.