How to refer to a table from a different script than the one created

hello developers…
So I made a table to know which players of a team are alive but my question is how do I know what is inside a table from a different script than the one I created? I think what he just said is too clear if you don’t understand it just read it again easy but if you can’t understand if you want ask me

1 Like

You could use Bindable Events between server scripts to connect from script “A” to script “B”, or you could turn the script B into a Module, so it can be called from any script

1 Like

You can use _G or a ModuleScript

_G

_G.Table = {"Hello"}
print(_G.Table) -- This only works if the Scripts are the same type

ModuleScript

local mod = {}
mod.Table = {"Hello"}

return mod
local Module = require(mod)

print(Module.Table)

then I put the table inside the module script to refer to the table from any script

Yup, using modules is the best way to connect scripts. You could use something similar to the example @DasKairo gave you, to build your module.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.