Keep object on rail?

I am creating a snowboarding game, I would like the snowboarder to be able to jump onto a rail and stick on it if hes holding c. I can’t think of any possible way to do this with my knowledge and I can’t find anything similar online with any sample code. If my character touches the rail, It should be center locked on it until the end of it or until he jumps off.

For reference, Im aiming for this ( go to 5:54 ) : Let's Play Amped: Freestyle Snowboarding Part 1: Brighton 1 - YouTube

Any help will be appreciated, Will give points to anyone who can help me with a starter code too ( JAVA SCRIPT )

Thanks

I would suggest that you get whatever the direction of the rail is running parallel to in world space and when the snowboard’s bottom collides with the rail and the player is pressing the C button, then keep your player constrained to only move in that direction.

I think you should try to do something with that info and come back showing some coding attempt if it doesn’t workout and then we can help out.