PointLight not updating?

I’m trying to make this pointlight change color every second, but for some reason, it stays white.

This is what the script looks like:

local light = script.Parent.PointLight

if light then
	while true do
		light.Color = Color3.new(math.random(1,255), math.random(1,255), math.random(1,255))
		print(light.Color)
		wait(1)
	end
end

The script seems to be working, as the output is outputting data:
17:46:19.454 210, 76, 135 - Server - Script:6
17:46:21.148 120, 21, 97 - Server - Script:6
17:46:23.161 120, 149, 69 - Server - Script:6
17:46:24.169 146, 207, 168 - Server - Script:6
17:46:25.183 148, 47, 23 - Server - Script:6

but for some reason, the pointlight doesn’t change color. Does anyone know why this could be occurring?

local light = script.Parent.PointLight

if light then
	while true do
		light.Color = Color3.fromRGB(math.random(1,255), math.random(1,255), math.random(1,255))
		print(light.Color)
		wait(1)
	end
end
1 Like

You need to use Color3.fromRGB if you want it to work, Color3.new() takes numbers from 0 to 1