# Initialize steps
scoreboard players set @s[tag=basicgunray] steps 128
scoreboard players set @s[tag=plasmarifleray] steps 128
# Move the ray
execute at @s run function ray_demo:ray/move

# Check if the ray hits
execute as @s[tag=hitEntity] at @s run function ray_demo:ray/hit
# as @e[dx=0,scores={invulnerable=0},tag=hitable] positioned ~-0.99 ~-0.99 ~-0.99 if entity @s[dx=0] positioned ~0.99 ~0.99 ~0.99 run say hit
# Destroy the ray (very important!)
kill @s
