How to make a spawner?

So im making this game and i want to have it so that anvils would spawn on the same z and y axis, but the x axis would change (black line). Could someone please help me with the code as i couldn’t find it anywhere…116286-red-stains.png

@tilenkolar8

Think about it man. You can probably see the same thing in a thousand different scripts. You just need to adjust it to your needs. If you wish to continue developing I recommend watching tutorials and learning how to program yourself or find a programmer in which you can have fun with and play around with different ideas. For now I will give you a decent enough script but I absolutely recommend putting further research in figuring out your next problem.

    public GameObject spawnObject;
    public Vector3 spawnPoint;
    public int maxX = 10;
    public int timeTilNextSpawn = 5;
    int x = 0;
    float timer = 0;

    void Start()
    {
        timer = 0;
        spawnPoint.x = x;
    }

    private void Update()
    {
        timer += Time.deltaTime;
        Spawn();
    }

    void Spawn()
    {
        if (timer >= timeTilNextSpawn)
        {
            x = Random.Range(0, maxX);
            spawnPoint.x = x;
            Instantiate(spawnObject, spawnPoint, Quaternion.identity);
            timer = 0;
        }
    }