I want people to configure the load asset to customize the looks from the model. But the script does not read the other content table from the "Settings Script"
The first script is named "Settings" And is a Module script.
1 | local settings = { } |
2 |
3 | --Lightings Configurations |
4 |
5 | settings.SunFlare = true --Additional Custom Sunrays to the sun (Not Roblox Default Sunrays) |
6 |
7 | return settings |
And i have another script name "MainSettings_Operation" Is another module() script.
1 | local settings = settings( getmetatable ) |
2 |
3 |
4 | if settings.SunFlare = = true then |
5 | script.Parent.Lensflare 1 :Clone().Parent = game.StarterGui |
6 | end |
SunFlare is set to "True" And i want the script to Clone the "Lensflare1" For the sun effects
However, the script does not give the gui and i Might have use a wrong code? Or I have a mistake in this system?
Module scripts are ascertained via the require() method. So, you would do require(PATH_TO_YOUR_SETTINGS_MODULE), then do settings.SunFlare == true if statement.
As long as you put the module name before the variable you should be able to access the settings. This is a very simple example:
Module
1 | local setting = { } -- you could also put settings in the {} like a table |
2 |
3 | setting.SettingHere = "Hello" |
4 |
5 | return setting |
Script
1 | local setting = require(game.ReplicatedStorage.ModuleScript) |
2 |
3 | print (setting.SettingHere) -- prints Hello |
This also works in LocalScripts