How to make a platform start moving when the player steps on it

Here’s the script I’ve tried so far

using UnityEngine;
using System.Collections;

public class Moving_Platform_Script_2 : MonoBehaviour {
	public Transform position1;
	public Transform position2;
	public float speed= 15f;
	public bool Switch = false;
	public bool start=false;
	public GameObject player;
	public GameObject platform;
	
	
	void FixedUpdate(){
		if(start==true){
		// For these 2 if statements it's checking the position of the platform
		if(transform.position==position2.position){
			Switch=true;
		}
		
		if(transform.position==position1.position){
			Switch=false;
		}
		if(Switch){
			transform.position=Vector3.MoveTowards(transform.position, position1.position, speed*Time.deltaTime);
		}
		else{
			transform.position=Vector3.MoveTowards(transform.position, position2.position, speed*Time.deltaTime);
			
		}
		}
		
	}
	void OnCollisionStay(Collision player){
			if (Switch) {
			player.transform.position=Vector3.MoveTowards(transform.position, position1.position, speed*Time.deltaTime);
		}
		else {
			player.transform.position=Vector3.MoveTowards(transform.position, position2.position, speed*Time.deltaTime);
			
		}
	}
	void OnCollisionEnter (Collision player){
		if (start == false) {
			start = true;
		}
		}

}

Any help would be appreciated

are you sure transform.position==position1.position is true? That is what I would have checked first, since everyhting else looks ok at first glance.

Other than that I’d make sure that the colliders collide properly.