How to trigger platform ?

hi , i am beginner with unity and coding . i want my character when he step on the platform the platform will move , right and left , or up and down .
i watched video on how to make the platform move constantly . but i did not find what i am looking for

This is an example using the linked script for Moving Platforms Horizontal and Vertical 2D (008.pdf @ rp-interactive.nl) and provided by Unity forum member @Realspawn1 , for which many thanks.

Edit the script as follows:

Add variable:

    private bool isOnPlatform;

Create two new methods to trigger when Player is on the Platform and when the Player is not on the Platform:

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag ("Player"))
            {
                isOnPlatform = true;
            }
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
            {
                isOnPlatform = false;
            }
    }

Make sure the Player Game Object is tagged as Player in Inspector.

Make sure that the Platform Box Collider 2D “Is Trigger” field is checked in Inspector.

Create a new method:

    private void MovePlatform()
    {

    }

Cut code from Update() method and paste it in MovePlatform() method.

In the Update() method, call the MovePlatform() method when Player is on the platform, as follows:

    private void Update()
    {
        if (isOnPlatform == true)
        {
            MovePlatform();
        }     
    }

I hope this helps you.

Eyo thats pretty dope, but how would I make it so that it just activates after im on the platform. For example, the platform isnt moving, i jump on it, it moves, I jump off it, it continues to move.