How do you set the dictionary values of a module script?

I want to have a module with the name of the player I want linked to a number that has some other purpose but I don’t know how to set the first values in the dictionary.
For example I have:
local module = require(game.ReplicatedStorage.ModuleScript) (Has no values inside at all yet)
GamerGodPro = 200 (This is in my server script)

I now want to make a dictionary with all the players that had a number linked to them and set that number to the player. Can someone tell me how to do this?

Since a module script is often essentially a table, it can be mutated and it will “sync” to all other references to the table.

local module = requrire(
module.GamerGodPro = 200

Then from a second script, you can access it:

local module = require(
print(module.GamerGodPro) --> 200
1 Like

I think I understand by why is it Any specific reason for that?

That’s just wherever your module is located, in your case it would be ReplicatedStorage.ModuleScript

Oh thanks for clearing that up.

1 Like

Also with this . What if I am not able to simply put the name as a string . Can I do this?
local module = require(
module.Player.Name = 200

Close, in this case it would be module[Player.Name] = 200. We want to use square brackets to create an index when we don’t know what the index is when we’re writing our code.

Essentially, it’s the equivalent of doing

local name = 'PlayerName'
module[name] = 200 --> same as doing module.PlayerName = 200
1 Like

Would I now be able to run the module script through a for i,v loop where i = name and v = number value?

Yep, you would want to use pairs for that.

local module = require(path)
for i,v in pairs(module) do
1 Like

Thanks for the help . I will use this once roblox decides it wants to work again.

1 Like

Never mind, I see you made this thread twice.