What is wrong with my script?

Here is my script, I’m trying to make a propaganda placer, can some one help me?

Thanks!

public class PlacePropaganda : MonoBehaviour {

	public GameObject[] propaganda;
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(Input.GetKeyDown(KeyCode.E))
		{
			Instantiate(propaganda, transform.position+(transform.forward*2), transform.rotation);
		}
	}
}

The error is that Instantiate expects a single object. You are trying to give it an array.

I don’t know what you want to happen when you press E, so here’s a random propaganda being spawned when you press E.

public class PlacePropaganda : MonoBehaviour 
{
     public GameObject[] propaganda;
     
     void Update () 
     {
         if(Input.GetKeyDown(KeyCode.E))
             SpawnRandomPropaganda();
     }
      
     void SpawnRandomPropaganda()
     {
         Vector3 ahead = transform.position + transform.forward * 2;
         GameObject randomPropaganda = propaganda[Random.Range(0, propaganda.Length)];
         Instantiate(randomPropaganda, ahead, transform.rotation);
     }
 }

If you want to spawn propaganda on walls (well, any surfaces), you can raycast from the cameras center to see if you hit anything. If you did, use that point and surface normal to position your propaganda.

public class PlacePropaganda : MonoBehaviour
{
    [Range(0.0f, 0.1f)]
    public float distanceFromWall = 0;
    public GameObject[] propaganda;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
            SpawnRandomPropaganda();
    }

    void SpawnRandomPropaganda()
    {
        RaycastHit hit;
        if (Raycast(out hit))
            InstantiateOnWall(hit);
    }

    void InstantiateOnWall(RaycastHit hit)
    {
        GameObject randomPropaganda = propaganda[Random.Range(0, propaganda.Length)];
        Vector3 position = hit.normal * distanceFromWall + hit.point;
        Quaternion rotation = Quaternion.LookRotation(hit.normal);
        Instantiate(randomPropaganda, position, rotation);
    }

    bool Raycast(out RaycastHit hit)
    {
        Vector3 centerOfViewport = new Vector3(0.5f, 0.5f, 0);
        Ray ray = Camera.main.ViewportPointToRay(centerOfViewport);
        return Physics.Raycast(ray, out hit);
    }
}