Momentum based rail grinding system?

what I mean by “momentum based” rail grinding is this (couldn’t find a better example): Sonic Adventure 2 - Final Rush (Maximum Rails) - YouTube

notice how when the player is on a downwards-facing rail, they move faster on the rail.

I want to make something like this where whenever the player is on a rail, they accelerate when moving downwards and decelerate when moving upwards. I also want to make it so when the player is going really fast and is off of the rail, they get launched by the speed they gained.

I tried to make this by spawning an ice part whenever the player touches a specific part (in this case that part is the rail) and attaching it to the player using a hinge. I didn’t make a script that spawns the ice part, so I attached the hinge on the player in studio while playtesting. All I need to do (besides spawning the ice part) is to make it so that the ice part and the players orientation changes when on a different rail. Any ideas?

For this you could maybe use something like Player.Character.UpperTorso.Orientation to detect whether the player is facing up or down, if the player is facing up it means they’re going up and if they’re facing down its the opposite and use that to change the WalkSpeed of the Player’s Humanoid.

If you have a system already scripted for running on rails, you can pretty much apply gravity*railSlope.y to their speed every frame.