diff --git a/public/index.js b/public/index.js index 9bc7e9a..61b27f9 100644 --- a/public/index.js +++ b/public/index.js @@ -101,8 +101,8 @@ socket.on('updatePlayers', (bPlayers) =>{ }) // console.log(fPlayers[id]) - fPlayers[socket.id].username = localStorage.getItem('username') - socket.emit('username',fPlayers[socket.id].username); + fPlayers[id].username = localStorage.getItem('username') + socket.emit('username',fPlayers[id].username); } else { // if players already exist