lets say that script 1 has the following
local mytable = {true,"hello","huoewyg"}
I want script 2 to be able to read that table, but I don’t know how to do that
lets say that script 1 has the following
local mytable = {true,"hello","huoewyg"}
I want script 2 to be able to read that table, but I don’t know how to do that
Use _G or ModuleScripts
for _G:
--first script
_G.mytable = {true, "hello", "huoewyg"}
--another script
while not _G.mytable do wait() end --if "mytable" doesnt exist then wait until it does
print(_G.mytable)
for ModuleScripts:
--modulescript
return {true, "hello", "huoewyg"}
--another script
local mytable = require(script.ModuleScript) --you have to find the directory of the ModuleScript instance
print(mytable)
lets say that I wanted to put a script inside of a part, would I put _G.mytable[1] if i wanted to make the cancolide true?
idk im trying to get the jist of tables rn
yes
something like
while not _G.mytable do wait() end
script.Parent.CanCollide = _G.mytable[1]
keep in mind that _G itself is a table
why can’t you just set the cancollide property directly?
He was just making an example for how to use _G
_G is not recomended I would use:
shared.myTable = {code,code,code,code,code)
--otherscript
print(shared.myTable)
shared and _G are literally the same thing
oh, my bad then. It was a weird example.
Personally I would use modulescripts because imo they are just cleaner and easier to manage
I know but _G breaks easier 
I advise against using _G. Modulescripts solve all of the problems that _G was intended to fix and they are just better