Cant put script into a variable

This is my script:

using UnityEngine;
public class CollisionScript : MonoBehaviour
{
public CollisionScript movement;
public void OnCollisionEnter(Collision collisionInfo) {
if (collisionInfo.collider.tag == “Obstical”)
{
movement.enabled = false;
}
}
}

4673420--439877--help please.PNG
When I try to put the Movement Script into the movement box nothing happens. Is there a fix to this? Also, if I use GetComponent I dont know how to use it, because I am new to unity.
Thanks!

Please use code tags.

The reason you can’t drag your MovementScript into your “movement” variable is because you declared your “movement” variable as having the type “CollisionScript”, and MovementScript is not a CollisionScript.

If you want the “movement” variable to reference a MovementScript, change its type

public MovementScript movement;

1 Like

It works! Thanks you!