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

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

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

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

_G.tablee = {}

5 comments

0

:o didnt know that :D

0

Lol.

0

Same error :/

0

Il try a Bindable Function :I

0

It's something you're doing then. _G. works just fine.

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