You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I am developing a GUI learning system and want to call functions from corresponding module scripts. For that, I let a user select subject, item and level (for example, Math, Addition, Level1) on the first screen to require the corresponding module script once a user presses
[Start] button.
What is the issue? Include screenshots / videos if possible!
I searched the dev forum and found how to change strings to instances,
but I don’t know how to convert strings to function names.
How ever your scripts are layer out (if it needs to be in each script then so be it), but what u would do is create a designated module for this and call the functions when needed from the server or remote event < local script.
As you can see on the right side of the second picture,
I named Addition for a module script and the folder hierarchy is:
Replicated Storage > Course Selection > Math > Addition
Because I will create other modules named as Subtraction, Multiplication, etc. later,
I need to name like this.
In this module, I want to store functions from Level1() to Level5(), returning question formulae and option answers set.
So according to your format, I will write
local Addition = {}
Addition [“Level1”] = function ()
return
end
Addition [“Level2”] = function ()
return
end
…
return Addition
Basically it means that you are initializing 2 variables to 1 value.
local variable = value
Since the variable question already has the value Addition[“Level1”], answers doesn’t have a value (aka a value of nil).
‘add ‘nil’ to value list to silence’ means that you just have to add a nil after that to get rid of the error
local variable1, variable2 = value1, value2 --1 comma on each side
If you want them to have the same value you can either do
local question, answers = Addition["Level1"], Addition["Level1"]
or
local question = Addition["Level1"]
local answers = Addition["Level1"]