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

Why is my BrickColor changing script resetting to white?

I created this script that changes BrickColor from each part of a model. However, I encountered a problem. After the parts go through the color changing process, they reset back to white at the end for no apparent reason. My script works through copying a script and pasting it inside each part in the "Wall" model. Here's the two scripts:

Main script:

game.Workspace.Bu.ClickDetector.MouseClick:connect(function()
	for _, object in pairs(game.Workspace.Wall:GetChildren()) do
		local script = game.Workspace.copy_me:Clone()
		script.Parent = object
	end
end)

Script being copied (copy_me):

object = script.Parent		
object.BrickColor = BrickColor.new("Dark taupe")
wait(0.1)
object.BrickColor = BrickColor.new("Copper")
wait(0.1)
object.BrickColor = BrickColor.new("Nougat")
wait(0.1)
object.BrickColor = BrickColor.new("Pastel brown")
wait(0.1)
object.BrickColor = BrickColor.new("Salmon")
wait(0.1)
object.BrickColor = BrickColor.new("Pastel Orange")

1 comment

0

Try not using script as a variable name, as it is a keyword. (line 3)

2 answers

In the last line of the "copy_me" script, you did

object.BrickColor = BrickColor.new("Pastel Orange")

The problem with this line of code is that "Pastel Orange" is not a valid BrickColor. The 'O' needs to be lowercase. Capitalization matters in BrickColors.

Change this line to

object.BrickColor = BrickColor.new("Pastel orange") -- lowercase 'o'

This is definitely the error in your script.

"Pastel Orange" is an invalid BrickColor value. The O should not be capitalized. Change it to "Pastel orange".

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