Help Please! i wanted to have a car spawn every second and this script gave me errors. (Forgive me, Im fairly new to this),

Does anyone know how to fix this? It would be very much appreciated.
:slight_smile:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InfiniteCar : MonoBehaviour
{



    public GameObject car;

    void Start()
    {

        InvokeRepeating("Inst", 1f, 1f);
    }




    void Update()
    {
        void Inst()
        {
            {
                Instantiate(car, transform.position, transform.rotation);
            }


        }

    }

}

Hey, I think that you should just simply write this :

GameObject cloneCar = Instantiate(car, transform.position, transform.rotation);  

You need to make reference to a variable before instancing some prefab.

*Note that your Inst() function must be outside of the Update() funct.