Can anyone tell me if there is any-way to check if there are any value's in a table? I tried string.len
but it give's bad argument #1 to 'len' (string expected, got table)
error.
Script:
local TestingTable = {} for _,v in pairs(script.Parent:GetChildren()) do table.insert(TestingTable,v.Name) print("Added "..v.Name) end while wait() do if string.len(TestingTable) > 1 then -- This is the part I need help with local testing = script.Parent:FindFirstChild(TestingTable[1]) table.remove(TestingTable,1) end end
Any help appreciated.
You can find the length of a table by placing a hashtag before it in a script. For example:
local tab = {1, "two", "3"} print(#tab) --Prints 3, the amount of values stored in the table.
You can then integrate this into your script like so:
if #TestingTable > 0 then --execute code end