How to make a variable accessible from other lua files?

First of all, this is about a gamemode.

Let’s say I have this code in init.lua:

Blah = false

Is it possible for a function in otherfile.lua to access the Blah variable in init.lua? If yes, then how?

That “Blah” variable is global, It can be accessed throughout any file that is included I believe…

Try just entering the variable in otherfile.lua…See if it works, Like

[lua]function printme()

It’s difficult for me right now to understand how dumb I really was.

Basically I have a variable ‘SpawnPoint = {}’ in init.lua, which holds the custom spawnpoints for all players, which they can set with a console command. When I used the command, it seemed to work but still I would not spawn where I saved my spawnpoint. I thought that it was caused by the point not being saved in the SpawnPoint variable but just right now, after 2 hours of struggling with this I actually noticed that I didn’t include in init.lua the file which contains the function that actually sets my position when I spawn -.-

Well thank you anyway, cause I would probably keep fighting with this thinking that it can’t access the variable in some way xD

_G[‘yourVar’] = function print(“it works!”); end


Or you could just not define it as local, all the _G shit is dumb it’s added to _G as long as it isn’t an upvalue.