I have this script that makes brick change colors, but I wonder how can I make so the SpotLight inside the brick can change colors instead of brick? Here's my script:
while true do script.Parent.Color = Color3.new (math.random (), math.random (), math.random () ) wait(1.5) end
To be honest, your code was correct pretty much, but instead of using Color3.new()
use Color3.fromRGB()
instead, as it actually uses RGB values ranging from (0, 255) Also inside of math.random()
you need 2 Integer arguments
like this math.random(1, 10)
1 will be the first argument and 10 will be the second argument.
Below is the fix:
local light = script.Parent while wait(1.5) do light.Color = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255)) end
If this solves your problem make sure to mark my reply as 'Answered'