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

How To Set Up Brick Color Config?

Alright, so let me explain. I am trying to set it up so that you have a file in replicated storage that holds brickcolors for you to quickly be able to change the color of the walls of the building without making any permanent changes.

The building I'm working on is a theatre.

So far this is my script

local part = script.Parent

local GameValue = game.ReplicatedStorage.Configuration:WaitForChild("WallColor")



function BrickColorChange(value)
	part.BrickColor = BrickColor.new(value.value)
end

BrickColorChange()

GameValue.Changed:Connect(BrickColorChange(GameValue))

I get the error Workspace.Auditorium.BaseBuilidng.Union.WallColourConfigScript:8: attempt to index nil with 'value' Workspace.Auditorium.BasebBulding.Union.WallColourConfigScript is the directory to the script.

The current value of WallColor is 59, 46, 39.

Any help is greatly appreciated.

Oh and I have the UsePartColor on the union set to true.

2 answers

On line 11, you aren't specifying the value, therefore it cannot get the value as it's nil so it will throw an error.

Hereis a fixed method.

local part = script.Parent

local GameValue = game.ReplicatedStorage.Configuration:WaitForChild("WallColor")



function BrickColorChange()
    part.BrickColor = BrickColor.new(GameValue.Value)
end

BrickColorChange()

GameValue.Changed:Connect(BrickColorChange)

3 comments

0

Also, brick color only accepts strings. Not RGB values.

0

Ah, so should I make the value a string instead?

0

BrickColor can be defined: -- By numerical index workspace.Part.BrickColor = BrickColor.new(11) -- By RGB values workspace.Part.BrickColor = BrickColor.new(128, 187, 219) -- By color name workspace.Part.BrickColor = BrickColor.new("Pastel Blue")

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