Problem with using Vector3.MoveTowards on randomly instantiated target

In my scene, I have a cube, and this slot that the cube moves towards/snaps into whenever the cube is placed near this collider within the slot.
The slots are prefabs that are instantiated at the beginning of each scene in different and randomized positions within the scene. Right now, I can’t make the cube move towards the slots ever since turning the slots into prefabs that alternate between different positions.

I have this script attached to the collider within my slot:

public class blockSlot : MonoBehaviour {

private bool correctBlockCubeBlue = false, correctBlockCubeGreen = false, correctBlockCubeRed = false;
public blockCheck check;
private int countCheck;

// Use this for initialization	
// Update is called once per frame
void Update () {	
	if (correctBlockCubeBlue || correctBlockCubeGreen || correctBlockCubeRed) {

void OnTriggerEnter(Collider other) {
		if (other.tag == "c_blue")
			correctBlockCubeBlue = true;
		else if (other.tag == "c_green")
			correctBlockCubeGreen = true;
		else if (other.tag == "c_red")
			correctBlockCubeRed = true;


Which then connects to this script that is attached to my cube:

public class blockCheck : MonoBehaviour {
public Transform target;
public float speed;

public void PlaceBlock()
	float step = speed * Time.deltaTime;
	transform.position = Vector3.MoveTowards(transform.position, target.position, step);


This used to work when the slots in my scene were still static and were not prefabs, but since I modified them into being instantiated during every start of a scene, I can’t seem to make the cube snap into the slots anymore. I know this has to do with the target transforms, but unfortunately, I’m at a complete loss on what to do.

You could have this way easier.
Make sure, you instantiate all slots first and all cubes second. Let the cubes look for their slots in Start

public string colorstring = "red";

void Start(){
target = GameObject.Find(colorString + "slot").transform;

Let the Cubes start walking by themselves in their Update()

Since this is a game and you wouldn’t want the situation where a slot is not present anyway, a null check should not be necessary to make before moving to the target.