How can I check for either things in a if statement

Ok, so I want to check if the player has either one of the key cards.
For example, if there is only a D key card and C key card that and open a door how can I check if the player has either one of them

1 Like

You could loop through their backpack to see if they have either of the cards in there. If the card is a model that they can hold, however, you’ll want to check to see if it can be found in the character as well otherwise it would not function if they were to hold the tool.

Useful links:
https://developer.roblox.com/en-us/articles/Loops
https://developer.roblox.com/en-us/api-reference/function/Instance/FindFirstChild

1 Like

You can do something like:

for _, item in ipairs(player.Backpack:GetChildren()) do
	if item.Name == 'D' or item.Name == 'C' then
		-- player has atleast one item
	end
end