change color of a block roblox script code example

Example 1: how to make a color changing brick in roblox studio

local MyPart = script.Parent
while wait(0.1) do
	MyPart.BrickColor = BrickColor.random() 
end

Example 2: Hw to make a part that changes color every second in roblox studio

--RGB Part 

local MyPart = game.Workspace.RGBPart --[ Change "RGBPart" With Your Part Name ]--
while wait(0.1) do --[ 0.1 = Changes Color Every 0.1 Seconds ]--
	MyPart.BrickColor = BrickColor.random() 
end --[ Script Officially Made By Rigby#9052 on Discord or JUB0T on Roblox ]--

Tags:

Lua Example