so here is my code
You set both of them to be -1.
You also need to change if("left") to if(isKeyDown('left')) because the string ‘left’ will always be true. Same for the right.
if("left")
if(isKeyDown('left'))