Why is my i pairs not working?

I keep getting the error that the players Humanoid doens’t have a property of color, even though I put in my code if v.ClassName == “Part” or “UnitOperation” then

Does anyone know how to fix this?

                   for i, v in pairs(character:GetChildren()) do
						if v.ClassName == "Part" or "UnitOperation" then
							v.Color = Color3.new(0,0,0)

Instead of using .ClassName

try using this built in function called :IsA(ClassName)

It’s better and more accurate.

if v:IsA("BasePart") or v:IsA("UnionOperation") then

The UnionOperation class inherits from the BasePart class (the BasePart class is the base class for all part-type instances), IsA("BasePart") alone will suffice.

1 Like

Also about or you have to redo the selection

Otherwise it will default to the given name.

local part = workspace.Part

part.Name = 'no'
print(part.Name == 'thing' or 'another') -- 'another'

instead you need to do

part.Name = 'no'
print(part.Name == 'thing' or part.Name == 'another') -- false
part.Name = 'another'
print(part.Name == 'thing' or part.Name == 'another') -- true
1 Like