execute if block ~ ~ ~ minecraft:rail[shape=north_south] run scoreboard players set @s bw_block 1493
execute if block ~ ~ ~ minecraft:rail[shape=north_east] run scoreboard players set @s bw_block 1493
execute if block ~ ~ ~ minecraft:rail[shape=north_west] run scoreboard players set @s bw_block 1493
execute if block ~ ~ ~ minecraft:rail[shape=east_west] run scoreboard players set @s bw_block 1494
execute if block ~ ~ ~ minecraft:rail[shape=south_west] run scoreboard players set @s bw_block 1494
execute if block ~ ~ ~ minecraft:rail[shape=south_east] run scoreboard players set @s bw_block 1494
#originally I only had two commands in here. I forgot that rails have more than 2 blockstates. But I'm not changing this now. The other scores are already occupied with other blocks and no one will read this comment anyway, but in case someone does... Hello!