I have the following code:

_G[script.Parent.room.Value .. "players"] = {}

Now lets say the variable room's value is 101, in the same script I could type: print(_G[var .. "players"]) and it would print the table(if var is 101). However, if I do that in any other script, it can't find the variable _G[script.Parent.room.Value .. "players"] Both are server scripts.

6 comments

0

Are you 100% sure that both have the same value (at any time, and from any script)?

0

Yes, they are the exact same.

0

Is that confirmed if you print(script.Parent.room.Value .. "players") immediately before use everywhere it's used?

0

No, I do not do that. But I do try typing print(_G["101players"]) in the run a command part on studio, and it always returns nil.

0

...try it.... is it what you expected?

0

I have found how to fix it! Now my code looks like this _G.rp[script.Parent.room.Value .. "players"] (I just added in a table rp.) Thanks so much for all the help!