Just make a seperate function and declare a new variable that uses it.
local function MyFunction()
-- code
local myVariable = 1 -- example
return myVariable
end
local myVariable
myVariable = MyFunction()
print(tostring(myVariable)) -- prints 1
That wouldn’t really work in my case since the function is defined in a seperate module
This is my current code:
local Container = require(script.Container)
for cIndex, category in Container.Data do
for sIndex, setting: {Name: string, Type: string, Min: number, Max: number, Function: } in category do
if setting.Type == "NumberInput" then
local frame = script.NumberInput:Clone()
frame.TextBox.Changed:Connect(setting.Function)
end
end
end
Forgive me if i’m wrong, because I seldom work with module scripts, but couldn’t you just do Container:MyFunction() instead of declaring the function as a variable?