Why arent my instantiated objects working when I swap scenes?

Hello! I am having a problem with making an instantiated object work :/. So when I go into my game scene and click play my instantiate function works. But when I go onto the main menu scene and press play and then play button it, it will load into the game but the instantiate function wont work. Here is my problem in video form: UnityGameError - YouTube here is my instantiate function code:
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JumpSpawn : MonoBehaviour
{
public Transform Spawns;
public GameObject Enemy;
public Rigidbody PRig;
private float timetospawn = 0.5f;
void FixedUpdate()
{
if (Time.time == timetospawn)
{
spawnenemy();

        timetospawn = timetospawn + 0.5f;
    }
}

void spawnenemy()
{
    int randomIndex = Random.Range(0, Spawns.Length);
    for (int i = 0; i < Spawns.Length; i++)
    {
        if (randomIndex == i)
        {
            GameObject clone = Instantiate(Enemy, Spawns*.position, Quaternion.identity);*

}
}
}
}`

Ok update. I noticed that when I press play then the spawners and things are working but the objects are still not being instantiated. I saw that the only thing that could not be working was the Time.time part so I was trying to make up solutions for it but none of them could work.
if (Time.time == timetospawn)
{
spawnenemy();
timetospawn = timetospawn + 0.5f;
}
The part where it says Time.time is where it is messing up and I dont know how. All help is very much appreciated!