Sim error failed cast on null

I get the sim error on the code below which
I am doing for class, I know very little about makecode but nether me nor my teacher can figure out why the code is erroring

P.S Josh it’s be reginn I didn’t steal my code from the internet

[https://arcade.makecode.com/S63686-12512-29047-60903]

1 Like

so, you’re changing rock to be rock type before actually creating the rock, so just put the “set rock to rock type” block thing after the block where you create the rock (same for sword).

2 Likes

yes mega0star01s right
you changing the rock type before creating the rock

1 Like