Making Unity Standard Asset FPS Controller work with moving platforms

I am currently making a game that will involve the player riding moving platforms. The player is currently Unity’s Standard Asset FPS Controller. I have seen some questions relating to this but I haven’t quite found my answer yet. I want the player to be able to jump onto a block that has a rigid body and be able to move with this object, while still being able to walk around atop the object (aka, not locking position of player on the object). An example would be having the player push an object to start it sliding and then jump on top to take it for a ride. I have experimented with making the moving platform/object the parent of my FPS controller as well as adding the velocities but without positive results. Thank you in advance!

Have a “PlatformFollower” class on your player. In this class, have a prePosition variable that stores the platform’s previous position and a Transform platform; variable for storing a platform reference. Then, however you’re deciding if your character is on a platform currently, add that platform to the platform variable whenever you get onto a platform, and in the script’s LateUpdate() calculate the delta between current and prePos of the platform and Add that to the player’s position. That way you do not override the character movement, merely add to it.

Here is a clean example of it, using a Property for the platform to reduce issues:

public class PlatformFollow : MonoBehaviour {
	
	//When landing on a Platform, add its .transform to this.
	public Transform Platform
	{
		set{
			platform = value;
			//When we add a new Platform, get its starting position so our calculations correct
			prePos = platform.transform.position; 
		}
		get { return platform;}
	}

	private Transform platform;
	private Vector3 prePos = Vector3.zero;

	void LateUpdate()
	{
		if(platform != null)
		{
			//We are calculating how much the platform moved by subtracting last frame's position, then ADDING it to our player's position.
			this.gameObject.transform.position += Platform.position - prePos; 
			prePos = Platform.position; //Set prePos for use next frame
		}
	}
}