Color changing light

Are you wanting to just change that 1 Brick’s Color for the Water & Light to change? If so, I believe you can look at this?
Environments and Terrain Tools) (Thanks ROBLOX)

No, I have a surface light and im trying to make the surface light thats in the water change colors so then the pool changes colors.

If that makes sense the light = the pool color so I’m trying to make the light auto-rotate between colors.

You can change the surface light colour.

surfaceLight.Color = Color3.New(color)

If you want to have all the lights together, then put them in a folder and then use a for loop to loop through each light and change the colour.

Is that how I make the surface light auto rotate colors from a rainbow for example/

Thats how you color the surface lights. It wont rotate colors.

How do I make it rotate colors?

You can do a loop to make it rotate colors

Well to make them change to like a rotation, you could use a loop, again to rotate the colours.

local t = 5; --how long does it take to go through the rainbow

while wait() do
	local hue = tick() % t / t
	local color = Color3.fromHSV(hue, 1, 1)
	--> set the color

Sourced: How to create a simple rainbow effect using TweenService

Example can be

while wait(1) do

SurfaceLight.Color =,255)/255,math.random(0,255)/255,math.random(0,255)/255)


It changes to a random color every second


and id replace math random with the light id correct?

You could probably do something relevant like this?

local SurfaceLight = workspace.Part.SurfaceLight
local Speed = 1

for Loop = 0, 1, 0.001 * Speed do 
    SurfaceLight.Color = Color3.fromHSV(Loop, 1, 1)

No, replace the SurfaceLight part with the location of your surface light. The math.random is the random colour generated to make the rainbow effect.

I dont recommend while true do cause of lag

So I added this script to the surface light and nothings happening? Am I suppose to replace something?

while wait(0.25) do
    script.Parent.Color = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))

Is there a way to make it a bit smooth and have it fade into the next color?

Jackscarlett posted code above that would do a smooth transition

1 Like

You can use TweenService for that.

local TweenService = game:GetService('TweenService')

while true do
local tween = TweenService:Create(script.Parent,, {Color = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))})


You can also do this:

local C = 1
local Colors = {
local TweenService = game:GetService("TweenService")
local Light = 

while wait() do
	local T = TweenService:Create(Light,,{Color = Colors[C]})
	if C == #Colors then		C = 1
	else						C += 1