Making script only effect one gameobject when attached to multiple

hey everyone, im making a short game for university and im having some problems with my script. The game is a tilting boardgame and i need it so that when the ball lands on a platform it only tilts and when it goes onto the next platform below the board above needs to stop tilting

so far i have this code however all the platforms in the scene are tilting where as I only want the platform that the ball to tilt

using UnityEngine;
using System.Collections;

public class Tilt : MonoBehaviour 
{
	float smooth = 1.0f;
	float tiltAngle = 15.0f;
	
	// Update is called once per frame
	void Update ()
	{
		//check if the user is pressing left or right, up or down on the keyboard
		//by default Unity assigns the "a" and "d" key as well as the left and right arrow keys to the horizontal axis and the "w" and "s" key as well as the up and down arrows keys to the vertical axis.
		float tiltAroundX = Input.GetAxis("Horizontal") * tiltAngle;
		float tiltAroundZ = Input.GetAxis("Vertical") * tiltAngle;
		
		Quaternion target = Quaternion.Euler(tiltAroundX,0, tiltAroundZ);
		
		this.gameObject.transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * smooth); 
	}
	
	void OnTriggerEnter(Collider other)
	{
		
		GetComponent<Tilt>().enabled = true;
	}
	
	void OnTriggerExit(Collider other)
	{
		GetComponent<Tilt>().enabled = false;
	}
}

Add a “am I turned on” variable:

public bool activeTilt=false;
// public only added for debugging

Update() {
  if(!activeTilt) return;
  ...
}

OnTrigEnter() { activeTilt=true; }

A better solution is probably to move tilting code into the ball, with public Transform activePlatform; changed by the ball’s triggerEnter. You can think of the ball as the player, and the player tilts the “current” platform.

Ive got it to work, Yes putting that code in the tilt script wasn’t the best way

using UnityEngine;
using System.Collections;

public class TiltActivator : MonoBehaviour 
{
	public GameObject fromBoard;
	public GameObject toBoard;
	
	
	void OnTriggerEnter(Collider other)
	{		
		if(other.tag != "Player")
		{
			fromBoard.GetComponent<Tilt>().enabled = false;
			toBoard.GetComponent<Tilt>().enabled = true;
		}
	}
}

I would attach this script to each of my Exit triggers and attach each board to its slot