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 trying to create a system that allows me to call any of my functions from anywhere inside a script, regardless of if they are called before the function is defined or not.
What is the issue? Include screenshots / videos if possible!
Doesn’t seem possible
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried moduleScripts, but I don’t understand them, and I don’t really want to use object values or remoteEvents.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- Here is what i'm trying to do
local function Test1()
Test2()
end
local function Test2()
print("this is dumb")
end
Test1()
I have adapted this into a semi-efficient form shown here
local function Test1()
print("this is function one")
FunctionCaller(2)
end
local function Test2()
print("this is function two")
end
function FunctionCaller(functionValue)
local functionArray = {local function() Test1() end, local function() Test2() end}
functionArray[functionValue]
end
If im right, this should allow you to call any function stored in that array, which is at least somewhat simple and easy to organize with.
local Functions = {}
function Functions.Test1()
print("This is function one")
Functions.Test2()
end
function Functions.Test2()
print("This is function two")
end
Well what do you mean by local? If you want these to be global just make it a module script in any directory accessible by both client and server and call require on it. I’m not really sure what you meant
I meant that it just says function functions.test1 and not local function functions.test1. I am pretty sure I know why this is but i’m just making sure.