Slime 2D Game

I have slime and i want to make it so that when the player walks on it, he walks slow

this is my script so far

#pragma strict

var currentSlowMo : float = 0;
var slowTimeAllowed :float = 2.0;

function OnTriggerEnter(other : Collider)
{
if(other.tag == “Player”)
{
if(Time.timeScale == 1.0)
Time.timeScale = 0.3;

else
	
	Time.timeScale = 1.0;
	Time.fixedDeltaTime = 0.02 * Time.timeScale;
}

if(Time.timeScale == 0.3)
{
	currentSlowMo += Time.deltaTime;
}

if(currentSlowMo > slowTimeAllowed)
{
	currentSlowMo = 0;
	Time.timeScale = 1.0;
{
}

}
}

Is this a 3D or 2D game? What you want to do is go into your script with the movement speed variable and make it a static var and then say in the slime script: (let’s say your movement variable is called movementSpeed and your and the script holding your movement speed variable is called Movement)

function OnTriggerEnter(other : collider) {
	if (other.tag == "Player") {
		Movement.movementSpeed*0.5;
		/*replace 0.5 with whatever movement reduction ratio you want*/
	}
}