Global Variables

Hello,

I am having trouble on making a file find a variable that is on a different file in the same folder.

try to make it read the file before you call the variable? To my knowledge lua in general won’t pick up variables from other files in the folder without telling it to

I don’t think that’s what he meant.
If you want to access values from a file that isn’t in autorun/, you have to use include & addcsluafile (if you need the client to have it)

I am working with a gamemode, the file is installed on the client and server. Right now I have a variable declared in “cl_f1menu.lua” and I am trying to access the variable from “cl_targetid.lua”.

When you declare the variable make sure it is out of scope completely and don’t use the keyword local at all with it.
You may be making it local or you may be making it inside of a function.
You can always declare a null value if that helps, just don’t put an equals.

If you have a variable in one file that doesnt have the keyword local and is declared out of scope, it is global for the client

Thanks, it is working now!