if(ball.x > canvas.width - ball.width/2)
{
ball.x= canvas.width - ball.width/2
ball.vx = -ball.vx
p1Score += 1;
context.fillText( "P1Score:" + p1Score,40, 30);
alert('YOU GET 1 POINT!!!')
return ball.x = 500
}
Instead of drawing the score when it changes, draw it outside of any if statement