"Or" condition doesn't work

I’m pretty sure I’m doing something wrong here but it seems like whatever I do using or in my conditions completely break it.

local function canOcclude(part)
	-- Occluders must be:
	-- 1. Opaque
	-- 2. Interactable
	-- 3. Not in the same assembly as the subject
	-- 4. Does not include the value "Transparentable"
	local farma = false
	for i,v in pairs(part:GetChildren()) do
		if v:IsA("BoolValue") then
			if string.lower(v.Name) == "occludecamera" or "occludecam" or "occam" then
				farma = true
			end
		end
	end
	return
		getTotalTransparency(part) < 0.95 and
		part.CanCollide and
		subjectRoot ~= (part:GetRootPart() or part) and
		not part:IsA("TrussPart") and
	    farma == true
end

Here is my code. It’s supposed to occlude parts that include a boolvalue with a name of “OccludeCamera”, “OccludeCam”, or “Occam”. And is not case sensitive. It doesn’t seem to work.

This script is inside of the popper script in the zoom script in the camera modules script in the player modules script in starterplayerscripts.

If you want to test this out yourself simply play the game and copy the player module and put it in starterplayerscripts whence you’re done and edit the function in the popper script at around line 142.

1 Like

or starts a completely new condition.

You’re gonna have to test string.lower(v.Name) against each name individually

like that

2 Likes

Heck yeah! Thank you so much, I never knew that before, and I’ve been scripting for more than two years :frowning:

1 Like