snobW0lf
(Snoww)
February 10, 2022, 11:18pm
#1
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)
snobW0lf
(Snoww)
February 10, 2022, 11:29pm
#3
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?
snobW0lf
(Snoww)
February 10, 2022, 11:31pm
#5
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?
snobW0lf
(Snoww)
February 10, 2022, 11:33pm
#7
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?
snobW0lf
(Snoww)
February 10, 2022, 11:35pm
#9
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)
snobW0lf
(Snoww)
February 10, 2022, 11:37pm
#11
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)
snobW0lf
(Snoww)
February 10, 2022, 11:39pm
#13
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”?
snobW0lf
(Snoww)
February 10, 2022, 11:47pm
#15
Alright, I did that and it did print and theres no infinite yield error
Forummer
(Forummer)
February 10, 2022, 11:55pm
#16
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.
Volieb
(Vinny)
February 10, 2022, 11:59pm
#17
Instead of Color3.new
, you need to do Color3.fromRGB
because you are using BaseParts. This should solve your issue.
Forummer
(Forummer)
February 11, 2022, 12:00am
#18
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
Volieb
(Vinny)
February 11, 2022, 12:01am
#19
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
Forummer
(Forummer)
February 11, 2022, 12:01am
#20
I’m assuming based off their avatar’s body colors that the color wasn’t changing whatsoever.