I’m trying to turn number of descendents into tablelength to compare them.
When a player enter into an area it adds a child of that pad. After the timer is up I check for number of descendents. No matter the amount of descendents it always prints “1”.
local map1Votes = {script.Pad1:GetChildren()}
local map2Votes = {script.Pad2:GetChildren()}
local map3Votes = {script.Pad3:GetChildren()}
local tableLength1 = {script.Pad1:GetChildren()}
local tableLength2 = {script.Pad2:GetChildren()}
local tableLength3 = {script.Pad3:GetChildren()}
print (tableLength1)
print (tableLength2)
print (tableLength3)
Can’t you just use # to get the number of descendants? I don’t get why you’re putting tables inside of another table since GetChildren returns a table of children of a specified object. So you’re basically doing {{ -- children in here }}
This would give you the number of descendants of a table (which is what GetChildren returns), then you can store it in a variable and compare them.
local storage = #workspace.Storage:GetChildren()
Also, the table won’t update if there is a new child added, so you would have to manually update the table to include the child added, which is what you can do with DescendantAdded, or you can alternatively do :GetChildren() once the player is added to the pad.