Why is the output shows that the “Value” is index nil?
This is the “RefreshColor” function:
local ColorModule = require(script.ColorModule)
function PlatformsModule.RefreshColor()
for _, platform in pairs(Platforms:GetChildren()) do
local randomObject = Random.new()
local chosenColor = ColorModule[randomObject:NextInteger(1, #ColorModule.ColorList)].Value
platform.BrickColor = chosenColor
end
end
local ColorModule = require(script.ColorModule)
local colorsRandomTable = {"Purple", "White", "Dark Red", "Cyan", "Light Green"} -- Add colors when you need to
function PlatformsModule.RefreshColor()
for _, platform in pairs(Platforms:GetChildren()) do
local randomIndex = math.random(1, #colorsRandomTable)
local randomColor = colorsRandomTable[randomIndex]
platform.BrickColor = ColorModule.ColorList[randomColor]["Value"]
end
end
They will not be able to expand the dictionary if they want to add more attributes to a color. Also, a naming convention is one of the things a dictionary is for. There will also be a problem in recognizing which color is which since you will need to add comments in each one.