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

For i,v color change help?

Asked by
Vividex 162
10 years ago

I tried something that I thought would save time, but it doesnt work, help?

local play = game.Workspace.Test

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

3 answers

Log in to vote
1
Answered by
Ekkoh 635 Moderation Voter
10 years ago

Your problem was you're missing an end. The if keyword opens a new scope, which needs to be closed with an end.

local play = game.Workspace.Test


for i,v in pairs(play:GetChildren()) do
    if v.BrickColor == ("Really black") then
        v.BrickColor = BrickColor.new("Institutional white")
        wait()
    end
end
0
Oh yeah, I forgot how to use ends < #Idiot xd Thanks! Vividex 162 — 10y
0
Wait, this doesn't work.. Vividex 162 — 10y
Ad
Log in to vote
-2
Answered by
acecateer 130
10 years ago
local play = game.Workspace.Test

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

Log in to vote
-2
Answered by
Necrorave 560 Moderation Voter
10 years ago

In order to fix this you may need to figure out what white is in rgb. (Reb, blue, green)

local play = game.Workspace.Test

for i,v in pairs(play:GetChildren()) do
    if v.BrickColor == ("Really black") then
    v.BrickColor = BrickColor.new(255,255,255) --This should be white
    wait()
end

This should work with what you are trying to do. In rgb, 255 is the highest value and 0 is the lowest. If you made all the values into "0" you would end up getting black.

0
"This should be white" -- What a zinger ;) Necrorave 560 — 10y
0
I thought RGB was only for things like ScreenGuis or SurfaceGuis? Vividex 162 — 10y
0
That's not his problem, and that wouldn't work. Ekkoh 635 — 10y
0
Ah, missed the end. You got it. Necrorave 560 — 10y

Answer this question