Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i access a Table which is stored in another script?

Asked by 10 years ago

Im in uncharted territory... Anyone know how?

In the script which is in the game workspace has a global table

tablee = {"Player1"}

Im trying to access it from a local script inside the players Backpack with:

for i, v in pairs(tablee) do
    if v == player.Name then
        table.remove(tablee, i)
        print(table.concat(tablee, ", "))
    end
end

And i get an error saying:

Players.Player1.Backpack.TouchedEvent:35: bad argument #1 to 'pairs' (table expected, got nil)

1 answer

Log in to vote
2
Answered by 10 years ago

To make things Global, instead of adding local before the variable/function/ect, add a "_G."

_G.tablee = {}
0
:o didnt know that :D mariko229 0 — 10y
0
Lol. ObscureEntity 294 — 10y
0
Same error :/ mariko229 0 — 10y
0
Il try a Bindable Function :I mariko229 0 — 10y
0
It's something you're doing then. _G. works just fine. ObscureEntity 294 — 10y
Ad

Answer this question