Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to access a table in another script?

I'm trying to create an inventory system, and have that player have an inventory while also displaying the inventory in a GUI. I've decided to use a table to store all of the inventory items(I don't think there is any other way) but i'm not sure how to go about getting table items in another script, if it is at all possible. Any suggestions?

1 comment

0

Module scripts? /shrug

1 answer

Ive heard of a global variable. But tables hold the same purpose so... I think the answer may be...

_G.Table = {}

To access your table globaly

_G.Table --Do what you want with it

2 comments

0

No, _G is the worst way.

0

Yeah, I agree with @incapaz. Instead of _G, you can use BindableEvents and BindableFunctions(that is pretty much the closest "replica" to _G but much better) or you can use ModuleScripts

This discussion is preserved as it was. New answers, comments, and votes are closed.