How to access specific function?

Hi,

So if i have a module where i hold every cosmetic function and i want to access a function using a string that has a function name how would i do it?

something like:

local functionName = "cosmetic1"
local module = require(myModuleWithCosmeticFunctions)

    event.OnServerEvent:Connect(function()
      module[functionName]()
    )

normally i would do:

local module = require(myModuleWithCosmeticFunctions)

    event.OnServerEvent:Connect(function()
      module.cosmetic1()
    )

will something like this work? Or maybe you know better way to access function using it name or something

Oh nevermind i just tested and it work so i can use string to get name of function

Yes you can do that and it will work.