How to change the specific colors of parts through a randomize event

Hey all, I’ve been trying to make it so that the disco tiles on the dance floor change to certain colors that I’ve selected, instead of making the tiles only change colors from the BrickColor pallet (currently using a randomize event to select random colors from the BrickColor pallet). Thought about adding certain colors to a table and it randomly chooses colors from that table, which might ultimately be how I do it although I’m not quite sure on how I’d do that necessarily. Mainly need colors that light up with neon appose to the ones which don’t light up as well with neon.

Script:

repeat wait(1)
	for i, v in pairs (script.Parent.DanceFloorTiles:GetChildren()) do 
	v.BrickColor = BrickColor.Random() 
	end
until nil 

This might work

local waitTime = 3 -- delay time

function colorChange()
	for i, floor in pairs(workspace.danceFloorTiles:GetChildren()) do
		floor.BrickColor = BrickColor.Random()
	end
end

colorChange()

while true do
	wait(waitTime)
	colorChange()
end

Also if your script isn’t in server script service u might want to put it in there.

I apologize If I wasn’t being clear enough.

dancefloor

My initial plan was to put specific colors that I’ve selected into a table, ones that glow rather than the ones that are a flat color. By default they’re neon, just some colors than the others don’t glow as good as other colors. The script works, just want some clarification or explanation how I’d implement that into this script. I want colors that glow.

so you want some to be neon and some to be plastic?

They want to pick values from a table of colors that glow, because some colors (based on saturation or hue, I forgot) don’t glow.

1 Like
local function pickFromTable(list)
 local index = math.random(1, #list)
  --No Tab key in dev forums :(
 for i, p in ipairs(list) do
  if i == index then
   return p
  end
 end
end

Then just do something like this:

part.Color3 = pickFromTable(colorTable)
--or
part.BrickColor = pickFromTable(colorTable)
1 Like