i have already looked this up on this site and have not found a solution.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class touch : MonoBehaviour
{
public follow script;
[SerializeField] private int fastspeed;
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("player"))
{
script.speed = fastspeed;
}
}