Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

For i,v color change help?

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

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

2 comments

0

Oh yeah, I forgot how to use ends < #Idiot xd Thanks!

0

Wait, this doesn't work..

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

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.

4 comments

0

"This should be white" -- What a zinger ;)

0

I thought RGB was only for things like ScreenGuis or SurfaceGuis?

0

That's not his problem, and that wouldn't work.

0

Ah, missed the end. You got it.

This discussion is preserved as it was. New answers, comments, and votes are closed.