I figured out how to fix it. I was using
or If Sprite | Value = 13
in an if loop above it in the code. For some reason this prevented it from working. I changed it to
or If System | Sprite.Value = 13
and it works again. In both cases this was just an or tagged on the end and wasn't even true in this case. Strange but atleast it's working now!