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

How to find if an value exists as in a lua table?

I would like to know how can a script find if a value exists in a Lua table, something like

luatable = {"abc", "cba", "bab"}
--example: wanted to know if something in workspace with a name of any of those values exists..

How can I do it?

1 answer

✓ Accepted answer

You Could Use A For Loop To Search Through The Descendants Of Workspace Or Whatever Your Looking For

Example

local Table = {"abc","bca","cab"}

for i,v in pairs(workspace:GetDescendants()) do -- Will Go Through Everything in the workspace
	if Table[v.Name] then -- If the name of the object is in the table
		-- Do Rest
	end
end

2 comments

0

Thank you!

0

np

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