Depends on the railroad. Many railroads now prohibit getting on and off moving trains. Where it is permitted, there's a very specific way to do it safely which is actually counterintuitive. You get on and off with the TRAILING foot, not the leading foot.