So when i loop and check for a folders name it doesn't get the names and instead does it like they don't exist. A solve would be very helpful thanks. No output errors. I have string values that get added into the folder
local v = script.Parent.Parent.Values local function makeLookupTable(table) -- Utility function to create a lookup table for i = 1,#table do table[table[i]] = true end return table end local whitelist = makeLookupTable({script.Parent.Parent.Parent.Parent.whitelists:GetChildren()}) --problem seems to be here script.Parent.MouseButton1Down:Connect(function() script.Parent.Parent.Values.count.Value = script.Parent.Parent.cmdcount.Text if v.torf.Value == false then v.torf.Value = true script.Parent.Text = "LOOPING" ------------------------------------------------------------- while wait(v.wait.Value) do if v.torf.Value == true then for _, player in ipairs(game.Players:GetPlayers()) do if not whitelist[player.Name] then game:GetService'Players':Chat(":"..tostring(script.Parent.Parent.cmd.Text).." "..tostring(player.Name).." ") end end end end elseif v.torf.Value == true then v.torf.Value = false script.Parent.Text = "OFF" end end)
It looks like in line 10
, that you are inserting a table in a table. Just try again but this time, remove the {}
, because :GetChildren()
provides you a table of arrays.
Edit : After printing results by replicating your code, I have found the error.
-- In Line 21, Instead of if not whitelist[player.Name] then -- It returns the value nil, so your code continues even if the name is there -- You must do if not table.find(whitelist, player.Name) then -- Finds the name of the player in the whitelist table
Edit 2 : I re-checked your code and using :GetChildren()
for instances. And the following code might work.
local blahblah = game.ReplicatedStorage.Folder:GetChildren() local function TableFinder(Name, Array) for _, Nam in ipairs(Array) do if Name.Name == Nam.Name then -- Do if the name is in the whitelist else -- Do if the name isn't in whitelist end end end TableFinder(player, blahblah) -- In your case, it's whitelist.
Lemme know if it helps!