RB-004
Roblox random colour changer script
Changes the colour of every part in a folder to a new random colour every few seconds.
- Script type
- Script
- Where it goes
- ServerScriptService
- Category
- World and effects
For your own game in Roblox Studio. Not for use in other people's games.
The code
-- Random colour changer: every part in the folder gets a new colour on a timer.
local FOLDER_NAME = "ColorParts" -- a Folder in the Workspace that holds your parts
local INTERVAL = 3 -- seconds between changes
local FADE_TIME = 1 -- seconds each colour takes to blend
local TweenService = game:GetService("TweenService")
local folder = workspace:WaitForChild(FOLDER_NAME)
while true do
for _, child in folder:GetDescendants() do
if child:IsA("BasePart") then
local newColor = Color3.fromHSV(math.random(), 0.7, 1)
TweenService:Create(child, TweenInfo.new(FADE_TIME), { Color = newColor }):Play()
end
end
task.wait(INTERVAL)
endHow to set it up
- In the Explorer, right-click Workspace, choose Insert Object, then Folder. Name it ColorParts.
- Drag the parts you want to change into that folder.
- Add a Script to ServerScriptService and paste the code.
- Play and watch them change.
Change it
- Raise the second number in Color3.fromHSV (saturation, 0 to 1) for stronger colours.
- To use only a few set colours, make a table of Color3 values and pick one with math.random(#colours).
- Set FADE_TIME to 0 for an instant change.
More in World and effects
More Roblox tools
- Shirt and pants templatesFree Roblox clothing templates to download: hoodies, jerseys, jeans, joggers and more.
- Robux tax calculatorWork out what you receive after the marketplace fee, or what to charge.
- Robux to USD calculatorConvert earned Robux to dollars at a DevEx rate you can edit.
- Shirt and pants template makerColour each panel of the 585×559 clothing template and download it.
- Username generatorGenerate usernames that fit the 3–20 character rule.