Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

For i,v color change? [Again]

Asked by
Vividex 162
10 years ago

I tried:

local play = game.Workspace.Play


for i,v in pairs(play:GetChildren()) do
    if v.BrickColor == ("Neon orange") then
        v.BrickColor = BrickColor.new("Institutional white")
        wait()
    end
end

Im thinking since I have a seat in the model, I'll need to check if its a part and make all the parts white, would I have to put (play:FindFirstChild("Part"))? Doesn't work, nothing in output. Help?

2 answers

Log in to vote
0
Answered by
Necrorave 560 Moderation Voter
10 years ago
local play = game.Workspace.Play


for i,v in pairs(play:GetChildren()) do
    if v.BrickColor.Name == ("Neon orange") then --v.BrickColor.Name was added
        v.BrickColor = BrickColor.new("Institutional white")
        wait()
    end
end

When you are referring to the actual string or name of the color, you must put ".Name".

PS: I am currently not at my desktop, so I cannot actually test through Roblox studio, but this is one thing I thought I should mention. Apologies if it does not fix the script entirely.

0
Thanks so much :D Vividex 162 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

What you have should work fine, you just have one problem. In line 5, you have parentheses after your if statement. Easy fix, here's the code:

if v.BrickColor == "Neon orange" then --got rid of the parentheses, those are only for BrickColor.new's.
0
Sadly it still doesn't work Vividex 162 — 10y
0
What's up with all these scripts? Does anyone know v.BrickColor == BrickColor.new("Neon orange") anymore? fireboltofdeath 635 — 10y

Answer this question