can anyone help me with my problem?

im learning to program with unity with the video course but im trying to add to it something of my own so i really learn, so i added stuff like spinning walls, speed platforms and and etc. but here is my problem:

this is the program of the player:
using UnityEngine;
using System.Collections;
public class player_move : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag (“Finish”))
{
other.gameObject.SetActive (false);
}
if (other.gameObject.CompareTag (“Speed”))
{
speed = 30;
}
}
}

and the bold part that i added makes it so that if you step on the qube with the speed tag it sets the speed from 10 to 30.
my problem is i dont know how to change the speed back to 10 when the player is off the pad, i tried

if (other.gameObject.CompareTag (“Speed”))
{
speed = 30;
}
else
{
speed = 10;
}
but it wont work because the whole section only works when on a trigger therefor will only be else if it touches another trigger.

if you do know how to add this, please write in the comments how i can fix this.

Add an OnTriggerExit method that sets it back to 10.

Also - please wrap your code in code tags when posting in the future.

Welcome to the forum. Please use code tags whenever you post code to help others by making your code more readable:

i will, thanks