I have a module that is supposed to return a Color3 Value from a table of Colors. On another script, it's supposed to print whatever was returned from the function. Below is the module.
local _M = {}
local teamColors = {
RED_COLOR = BrickColor.new("Really red").Color; --".Color" returns the Color3 value of a BrickColor
ORANGE_COLOR = BrickColor.new("Deep orange").Color;
YELLOW_COLOR = BrickColor.new("New yeller").Color;
GREEN_COLOR = BrickColor.new("Lime green").Color;
BLUE_COLOR = BrickColor.new("Really blue").Color;
LIGHT_BLUE_COLOR = BrickColor.new("Toothpaste").Color;
PURPLE_COLOR = BrickColor.new("Bright violet").Color;
PINK_COLOR = BrickColor.new("Hot pink").Color;
BROWN_COLOR = BrickColor.new("Brown").Color;
BLACK_COLOR = BrickColor.new("Black").Color;
WHITE_COLOR = BrickColor.new("White").Color;
}
function _M.returnColor(color)
local moduleColors;
for i, v in pairs(teamColors) do --Problem is around here?
return v
end
end
return _M
I'm really new to Modules and the use of them so everything is very basic here. The output prints (0, 0, 0) which is black. It should print Red first and after that continue until black. It should only print once because "print()" is called when a player clicks a GUI button.
Also, am I going on the right path for this or can I change some things?

3 comments
What do you want
returnColorto do? Return a random color? Return a list? You can only return one object. What do you need this code for?Your returnColor function is only returning the first colour it iterates onto. What are you looking to do?
It's supposed to return one color at a time like LetThereBeCode answered with. Sorry for not elaborating this so much. Also, it seems like not replying back gets me a free down.