How do I detect in which dimension every player is and store it in a scoreboard?

Like I don't want to detect it only when the player changes dimension, I want a tick function to detect each player's dimension. How can I do that?

Continue to help post