I don’t know if it really made a difference but we had similar issues with my son’s club team.
We changed our warmups and required the players to take them more seriously.
We organized them so that there was no idle time. The players were always busy doing something. We found if they weren’t busy that’s when they would screw around.
We tried to use the warmups to help them mentally focus for the game.