#Is it possible to create a global const that can be referenced between all scripts

14 messages · Page 1 of 1 (latest)

amber rock
#

Title

smoky dragonBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

fast gyro
#

global does exactly that. Put it in startup_scripts and it can be referenced in server and client.

amber rock
#

would that work with an array tho?

const MusicDiscs = [ "11", "13", "blocks", "cat", "chirp", "far", "mall", "mellohi", "otherside", "pigstep", "relic", "stal", "strad", "wait", "ward"]

I tried swapping const MusicDiscs to Global.MusicDiscs and now it thinks its undefined

fast gyro
#

global is just another variable. global.MusicDiscs will do exactly what you say. Make sure your script load order is correct if you're trying to use it on the startup side.

#

Where are you checking it and getting undefined?

amber rock
#

its in a startup script and its not finding itself in the same script oddly

fast gyro
#

I mean you still have to reference it the same way

#

global.MusicDiscs.forEach...

amber rock
#

Oh I see

fast gyro
#

MusicDiscs isn't the variable name.

#

global is just a fancy dictionary at this point.

amber rock
#

awesome this is exactly it, thank you!