Hi, I am trying to make any part using the colour 40, 127, 71 change to 1,1,1 but for some reason I can’t get the code to work. Could anyone help me?
i, v in pairs(workspace:GetChildren()) do
wait()
if v.Color == Color3.new(40, 127, 71) then
v.Color = Color3.new(1, 1, 1)
end
end
When I run this code, I get the error i, v in pairs(workspacer:GetChildren()) do wait() if v.Color == Color3.new(40, 127, 71) then v.Color = Color3.new(1, 1, 1) end end:1: Expected '=' when parsing assignment, got 'in' - Studio
What I see in the error is that you missed the “for” part of the loop, as InceptionStrange stated above.
And It’s not so good idea using wait() in a loop without any number.
I just did this, there are no errors but nothing is changing…?
for i, v in pairs(workspace:GetDescendants()) do
wait()
if v:IsA("MeshPart") and v.Material == Enum.Material.Grass and v.Color == Color3.fromRGB(40, 127, 71) then
v.Color = Color3.fromRGB(1, 1, 1)
end
end
for i, v in pairs(workspace:GetDescendants()) do
wait()
if v:IsA("MeshPart") and v.Color == Color3.fromRGB(40, 127, 71) then
v.Color = Color3.fromRGB(1, 1, 1)
end
end
Is it a basepart ur object? If so, check if it is a BasePart.
for i, v in pairs(workspace:GetDescendants()) do
if v:IsA("MeshPart") and v.Color == Color3.fromRGB(40, 127, 71) then
v.Color = Color3.fromRGB(1, 1, 1)
end
end
Alao tht wait is probably slowing it down. Try this code, wt i presume happened b4 was in each iteration it waited 1 second which means it will take longer to change color.