Else firing at the same time

image

local R3 = Region3.new(Zone_CFrame.Position - Zone_Size/2, Zone_CFrame.Position + Zone_Size/2)
		
		local Parts = workspace:GetPartBoundsInBox(R3.CFrame, R3.Size)
		
		for Key, Variable in Parts do
			
			local Index = Players:GetPlayerFromCharacter(Variable.Parent)
			
			if Index and Index == Player then
				print("a")
			elseif not Index then
				print("b")
			end
		end

Well it’s looping through a lot of parts. Not all of them are going to be the player’s character, hence the else part is firing.

I tried doing OverlapParams but it didn’t work

		local OLP = OverlapParams.new()
		OLP.FilterDescendantsInstances = {Character}
		OLP.FilterType = Enum.RaycastFilterType.Include

The else statement doesn’t even need to exist. Just remove the else statement if the outputting is annoying you.

1 Like