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?
Also with this . What if I am not able to simply put the name as a string . Can I do this?
local module = require(path.to.module)
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