The tables :
ListOfSpells = {"avada kedavra","duro","expelliarmus"} ColorsN = {"Lime green","Bright yellow","Bright red"} ColorsNu = {Color3.new(0,170,0),Color3.new(255,255,255)}
The part of script that should get the values from the table:
for Number,inList in pairs(ListOfSpells) do if SpellName == inList then Tool.Activated:wait() functions.CreateSpell(ColorsN[Number],ColorsNu[Number],SpellName,Player) end end
The CreateSpell is MainModule function
local functions = require(script.ModuleScript)
Everything works except of the ColorsNu values It should color PointLight to the ColorsNu[Number] value
First of all, instead of having three separate tables, why not just use one? Secondly, why store both BrickColor names and then Color3 values? Here's an easier implementation.
Tables
local spells = { { ["name"] = "Avada Kedavra", ["color"] = "Lime green" }, { ["name"] = "Duro", ["color"] = "Bright yellow" }, { ["name"] = "Avada Kedavra", ["color"] = "Bright red" } }
The CreateSpell bit
for x,y in pairs(spells) do if SpellName == v["name"] then -- Checks if SpellName is the same as the current spell we're on Tool.Activated:wait() functions.CreateSpell(BrickColor.new(v["color"]),SpellName,Player) end end
You'll need to rewrite the CreateSpell function itself a bit to remove the 2nd Color3 argument, and instead make it so that it uses the BrickColor passed to it.