How can i rotate a 3D platform and fix a little problem?...

I am using the First Person Controller script from Unity.
If i jump on a platform i use this script to hold the character on a platform, so he is moving with it:

	void OnTriggerEnter (Collider other)
	{
		if (other.gameObject.tag == "Player") 
		{
			other.transform.parent = gameObject.transform;
		}
	}

	void OnTriggerExit (Collider other) 
	{
		if (other.gameObject.tag == "Player") 
		{
			other.transform.parent = null;
		}
	}

The problem with that is… i also get the same rotation of that object(platform) and this makes the problem. If i jump on it or from it away. I get a whole different rotation on my character and it makes it unplayable.

To rotate the platform i use this script, both scripts are on the rotating platform:

	float y;
	public float speedY;
	void FixedUpdate ()
	{
		y += Time.deltaTime * speedY;
		transform.rotation = Quaternion.Euler(0,y,0);
	}

public bool onObject;
public bool freeFromObject;

    void OnTriggerEnter()
    {
    freeFromObject = false;
    onObject = true;
    }
    
    void OntriggerExit()
    {
    onObject = false;
    freeFromObject = true;
    void IfFreeOfObjects()
    {
    Transform.Rotate(5*speed*Time.DeltaTime,0,0);
    }
    
    void IfOnObject()
    {
    Transform.Rotate(objectIWantToRotateWith);
    }
    
    
    Void FixedUpdate()
    {
    if(onObject)
    {
    IfOnObject();
    }
    else if(freeFromObject)
    {
    IfFreeFromObject();
    }
    }

As @hexagonius said, use OntriggerEnter to store original player rotation and OnTriggerExit to restore it. But, to set the parente, use method .SetParent of the transform. It has a second parameter that lets you to keep original world position/rotation/scale while parenting…

Something like:

Quaternion _playerOriginalRotation;

void OnTriggerEnter (Collider other)
     {
         if (other.gameObject.tag == "Player") 
         {
             _playerOriginalRotation = other.transform.rotation;
             other.transform.SetParent( gameObject.transform, true);
         }
     }
 
     void OnTriggerExit (Collider other) 
     {
         if (other.gameObject.tag == "Player") 
         {
             other.transform.parent = null;
             other.transform.rotation = _playerOriginalRotation;
         }
     }