Hello! I am trying to make a function where the game loads different lighting via a module script in a map, but my issue is that there doesn’t seem to a clear cut way to do this (that i know of)
I am willing to:
Check the dictionary key (which looks like module.whatever property) and set it to the value
module.Brightness = 3
or run through every property in the lighting, and check if it has a place in the module and set it if it does.
My function looks like this for now
function loadLighting(map)
local lightingmodule = require(map:FindFirstChild("mapLighting"))
if lightingmodule then
for i,v in lightingmodule do
-- Do whatever here
end
end
end
Like always, any help is very useful and thank you for reading!
I’m not entirely certain I understand exactly what it is you want to do.
But
for i,v in lightingmodule do
-- Do whatever here
game.Lighting[i] = v
end
Would that technically do what you wish to accomplish? It will of course error if the property name doesn’t exist in lighting, but you could throw it in a pcall or design your module to have a module.Properties thing if it holds more than just valid lighting properties.