raycast limiting

how could I limit a raycast on a certain axis? I currently have a magma cube going to ^ ^ ^10 but I need to make so it gets on the coord 0 in x axis (can't just 0 ~ ~ after tping cuz it gets distorted)

Continue to help post