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

How do I fix my script for my floor in my club to make the colors change to random ones?

Can someone please fix my script for me I have tried more than 10 things to fix it...

2 answers

Well, if you want to change a bricks color to a random one, all you have to do is

part.BrickColor  = BrickColor.Random() --assuming part is defined

let me break it down for you. BrickColor is a Data Type of Roblox that stores colors such as "New Yeller". Each BrickColor has its own special numeric id that represents the color. (i.e. 1 is white). BrickColor is a child property of "Part" , meaning it can only exist inside of a part.

print(game.Workspace.Baseplate.BrickColor)
--will return the BrickColor of Baseplate

BrickColor.Random is a function or method that generates a random numeric id for the BrickColor. You could use it in a loop to create a rainbow block!

while true do -- a while loop, which repeats while its parameters are true
	wait(1) --you need a wait or you will crash
	part.BrickColor  = BrickColor.Random()
end --don't forget the end to close the loop!

I hope this helped! -connor12260311

--Old script

--brick color change Made by: iiKinqTerm! brick = script.Parent

while true do brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) brick.BrickColor = BrickColor.new.random wait(0.5) end

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