I think the problem is this block of code
if ProjectObj.GamePlayer.PlayerSprite.CurState > 7 then
arBtn0Shots(0).CurState = ProjectObj.GamePlayer.PlayerSprite.CurState - 8
else
arBtn0Shots(0).CurState = ProjectObj.GamePlayer.PlayerSprite.CurState
end if
The "7" and "8" in this block suggest that the script is designed to work with an 8-directional sprite/attack, but your attacks can only go left or right. That block of script is designed to make the sword sprite match the state of the player sprite so the attack goes in the right direction. Apparently the player sprite has 16 states but your sword only has 2. So an error occurs after you put the sword sprite sprite into state 2 and there are only 2 states (0 and 1).