Trying to add two separate conditions to one if statement

what I’m attempting to accomplish is an if statement that checks two different item names to see if either of them match a certain item’s name. here’s the code:

if t[1].Parent.Name == rTable[1] or rTable[2] then if t[2].Parent.Name == rTable[1] or rTable[2] then
	   local combination = UniqueFruits.Pineapple:Clone()
	   combination.Parent = ws.PhysicsItems
	   combination.Handle.Position = script.Parent.Position+0.5
    end
end
1 Like

I found out how by messing around with the code.

1 Like

the second statement “or rTable[2]” will check if rTable[2] not equals nil.

1 Like
for _, v in ipairs(t) do
	for _, v2 in ipairs(rTable) do
		if v == v2 then
			--Do code.
			break --Break the inner loop.
		end
	end
end
2 Likes