I need some help fixing this error and I cant fix it

im getting this one error and I cant fix it here is the error
Screenshot 2022-02-08 083724
and here is my code
https://glitch.com/edit/#!/multiplayer-game-yes?path=package.json%3A1%3A0
but this is really getting annoying ive been at the error for a bit now like 7 hours or so.
I also made a little demo (its commented right now) where the square follows the mouse and it uses some of the same stuff and works so i dont know.
I can also console.log(players[uid].velX, players[uid].velY); So this is very weird

Can you send me your project?

https://glitch.com/edit/#!/multiplayer-game-yes
here ya go

It looks like player[uid] is somehow undefined. Try console logging that to see what’s the problem. I think it might be somehow related to uid being out of range

I can only access players[uid] inside of one of the cvs.addEventListener()'s

Then you might need to make it a global variable to access it everywhere

it is a global variable

Upon rechecking the code,i don’t think you’re declaring uid anywhere

its in ws.js

also the error is saying that velX is undefined not uid

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.