Help with changing a part color

if game.Players:findFirstChild(character.Name).leaderstats.Points.Value >= 1000 then
		return	
	elseif  game.Players:findFirstChild(character.Name).leaderstats.Points.Value <= 1000 then
		print("test")
		workspace:WaitForChild(character.Name):WaitForChild("Left Arm").Color = Color3.new(0,0,0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Arm").Color = Color3.new(0,0,0)
		workspace:WaitForChild(character.Name):WaitForChild("Torso").Color = Color3.new(0,0,0)
		workspace:WaitForChild(character.Name):WaitForChild("Left Leg").Color = Color3.new(0,0,0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Leg").Color = Color3.new(0,0,0)
		workspace:WaitForChild(character.Name):WaitForChild("Head").Color = Color3.new(0,0,0)

Here is the part of the script I have thats causing the issue,
the print will happen but the parts will stay the same color. How do I make it so it changes the color

What does the character.Name print?
you should use BrickColor if you are changing a part color.

Part.BrickColor = BrickColor.new(0, 0, 0)

I meant that

Print("test)

Will go through but nothing below it will

You should try printing the character.Name to make sure it’s not nil
Is it a Script or a Local Script?

Its a script, and when i print character.Name it comes out as my user

Why do you use elseif do you want to add more statements or only 1?

I use elseif because the first line is checking if they have over 1000 points and if they dont i use the elseif

Are you using a character added Event?

yes i am, heres the full script

local Players = game:GetService("Players")

local function onCharacterAdded(character)
		
	if game.Players:findFirstChild(character.Name).leaderstats.Cotton.Value >= 1000 then
		return	
	elseif  game.Players:findFirstChild(character.Name).leaderstats.Cotton.Value <= 1000 then
		print("test")
		print(character.Name)
		workspace:WaitForChild(character.Name):WaitForChild("Left Arm").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Arm").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Torso").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Left Leg").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Leg").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Head").BrickColor = BrickColor.new(0, 0, 0)
	end
	
end
	local function onPlayerAdded(player)
		player.CharacterAdded:Connect(onCharacterAdded)
	end

	Players.PlayerAdded:Connect(onPlayerAdded)

Try this

local Players = game:GetService("Players")

local function onCharacterAdded(character)
		
	if game.Players:findFirstChild(character.Name).leaderstats.Cotton.Value >= 1000 then
		return	
	else
		print("test")
		print(character.Name)
		workspace:WaitForChild(character.Name):WaitForChild("Left Arm").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Arm").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Torso").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Left Leg").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Leg").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Head").BrickColor = BrickColor.new(0, 0, 0)
	end
	
end
	local function onPlayerAdded(player)
		player.CharacterAdded:Connect(onCharacterAdded)
	end

	Players.PlayerAdded:Connect(onPlayerAdded)

I tried doing that as soon as you suggested it but it still doesnt work. No errors in the output either.

Try this again

local Players = game:GetService("Players")

local function onCharacterAdded(character)
		
	if game.Players:FindFirstChild(character.Name).leaderstats.Cotton.Value >= 1000 then
		return	
	else
		print("test")
		print(character.Name)
		workspace:WaitForChild(character.Name):WaitForChild("Left Arm").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Arm").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Torso").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Left Leg").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Right Leg").BrickColor = BrickColor.new(0, 0, 0)
		workspace:WaitForChild(character.Name):WaitForChild("Head").BrickColor = BrickColor.new(0, 0, 0)
	end
	
end
	local function onPlayerAdded(player)
		player.CharacterAdded:Connect(onCharacterAdded)
	end

	Players.PlayerAdded:Connect(onPlayerAdded)

I tried it but the same thing happens

Try printing something under

workspace:WaitForChild(character.Name):WaitForChild("Head").BrickColor = BrickColor.new(0,0,0)

and see if it prints. And also, does the output show something like “infinite yield possible”?

Alright, I did that and it did print and theres no infinite yield error

local Players = game:GetService("Players")

local function onPlayerAdded(player)
	local function onCharacterAdded(character)
		player.CharacterAppearanceLoaded:Wait()

		if player.leaderstats.Cotton.Value >= 1000 then
			return	
		else
			character:WaitForChild("Left Arm").Color = Color3.new()
			character:WaitForChild("Right Arm").Color = Color3.new()
			character:WaitForChild("Torso").Color = Color3.new()
			character:WaitForChild("Left Leg").Color = Color3.new()
			character:WaitForChild("Right Leg").Color = Color3.new()
			character:WaitForChild("Head").Color = Color3.new()
		end
	end
	
	player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

This works for me.

image

Instead of Color3.new, you need to do Color3.fromRGB because you are using BaseParts. This should solve your issue.

BrickColor.new() will return a BrickColor value even if it is called in an incorrect manner.

print(BrickColor.new(0, 0, 0).Name) --Really black

That is why your solution with empty arguments for Color3 works. If he wanted to use colors other than black, it would not work.

Therefore, using Color3.fromRGB(50,50,50) or any other numbers will work, but Color3.new(50,50,50) will not

I’m assuming based off their avatar’s body colors that the color wasn’t changing whatsoever.