Code:
local Test = {}
Test.Hello = 2
print(workspace[Test.Hello].Name)
I can’t do this, but I’m not sure of any other way(s) without changing my entire code structure.
Code:
local Test = {}
Test.Hello = 2
print(workspace[Test.Hello].Name)
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
print(Groups[Test.NumberRequired])
This prints nil as well.
Something weird is doing on for me at least, ignore the reply above.
I’m just dumb, I didn’t even put the correct name in my original code (which I never showed)…
Sorry about that.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.