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

Why doesn't this print out the name of the kingdom?

wait(1)
Kingdoms =	{game.Workspace.Kingdoms:GetChildren()}

print(Kingdoms[1])

2 answers

Because Kingdoms[1] is a Table.

GetChildren() returns a Table, a list of the Child Objects for the given Object. Your code is effectively doing this:

Kingdoms = {{workspace.Kingdoms.Kingdom1, workspace.Kingdoms.Kingdom2 --[[etc.]] }}

To fix your code, simply remove the curly braces on line 2.


As a side note, it's a good idea to print the Name of the Model explicitly. ROBLOX will print the Name by default when trying to print the object itself, but it's better to be explicit.

wait(1)
Kingdoms =  {game.Workspace.Kingdoms:GetChildren()}

print(Kingdoms[1])

Simply do this

wait(1)
Kingdoms =  game.Workspace.Kingdoms:GetChildren()

print(Kingdoms[1])

Done! :D

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