Indexing with the dot operator bypass?


local Test = {}
Test.Hello = 2

I can’t do this, but I’m not sure of any other way(s) without changing my entire code structure.

To clear it up: It prints nil, even if I remove the .Name, which is odd to me.


Works fine for me, are you sure that you have something that’s named 2 inside within your workplace area?

The square brackets are used for indexing values within Dictionaries, if it’s unable to find the said “Name” inside the workspace then it returns back an error

If an instance is named “2” then do tostring(Test.Hello).

If you want to get the second child in workspace (not counting names) use workspace:GetChildren()[Test.Hello].

If you want to get descendants just use GetDescendants() instead.

Here’s another example:

local Groups = {
    ['test'] = {
        number = 2

local Test = {}
Test.NumberRequired = 500


This prints nil as well.

Something weird is doing on for me at least, ignore the reply above.

1 Like

I’m just dumb, I didn’t even put the correct name in my original code (which I never showed)…
Sorry about that.

1 Like

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