Table not filling in correctly

I’m trying to have a table that has every player’s User ID as the key and 0 for the value, at least for initialization. Here’s the code I made for it:

for i, p in pairs(game.Players:GetChildren()) do
    mgman.moons[p.UserId] = 0

The expected result is for the table to have all the User IDs linked to the number 0. However, this is not the result. When I try to print the table, I get this:

["-1"] = 0, ["-2"] = 0

I can’t see why this would happen. If someone knows the problem, I would very much appreciate the solution. Thanks.

Firstly, use game.Players:GetPlayers() instead of GetChildren().

Can you send more of the script? There is not enough data in the provided code to conclude an issue.
What is mgman.moons set to before you start assigning player values?

Before this runs, it just runs

mgman.moons = {}

inside of a module script (mgman)

Are you testing using in studio with Player1 and Player2? If so, your output is correct as the UserIds of these players are -1 and -2.

I see. Thank you for helping. Do you know if there is a way to use a different User ID for testing?

Not multiplayer. You can always test with one player by pressing the play button.