Black screen when moving right away upon loading

I am experiencing a black screen if I move the player within a second upon loading. The player’s coordinates go to NaN and I’m not sure what is causing this to happen. Everything loads visually, but if I move within a second upon loading, it goes black. Rotating and clicking right away doesn’t cause it, just moving right away. I’ve tried all of the black screen solutions here and none of them are working

I solved it actually. It was very simple. I was adding a variable to the player’s velocity but I didn’t have the variable defined initially, so when I moved the player before the function that defined the variable completed, it was adding an undefined variable to the velocity so of course that happened.