Landor151
(LandorKerman)
#1
-
What do you want to achieve?
Be able to check stuff in a table.
-
What is the issue?
I Can’t or Don’t know how to
-
What solutions have you tried so far?
I searched in the dev forum, I mean i tried at least but I couldn’t find any
local Table = {"Oxygen", "Nitrogen"}
if script.Parent.Value == Table then
print(1)
end
The code is in a while loop.
Lostude
(Lostude)
#2
You can get the index of a value.
For example, Oxygen is the first value so you can say in code Table[1]
local Table = {"Oxygen", "Nitrogen"}
if script.Parent.Value == Table[1] then
print(1)
end
Landor151
(LandorKerman)
#3
yeah but the parent’s value cant be nitrogen too
Lostude
(Lostude)
#4
You can then use a for loop.
local Table = {"Oxygen", "Nitrogen"}
for i = 1, #Table do
if script.Parent.Value == Table[i] then
print(1)
end
end
1 Like
Use table.find:
if table.find(Table, script.Parent.Value) then
4 Likes
system
(system)
Closed
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.