Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I make a lamp that changes a color every 0.5 sec, but code does not work,can you help me?

Asked by 1 year ago
Edited 1 year ago

here code:

local light = script.Parent 

while true do

    local r = math.random(1,254)
    wait(0.0001)
    local g = math.random(1,254)
    wait(0.0001)
    local b = math.random(1,254)
    wait(0.0001)

    local rColor = Color3.new(r,g,b)
    light.Color += rColor

    wait(0.5)
end

error:

Workspace.Model.Part.PointLight.Script:15: attempt to perform arithmetic (add) on Color3

0
i have already made) roblox_niks2 0 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

i have already made)

answer:

local light = script.Parent

while true do

    local r = math.random(1, 254)
    wait(0.0001)
    local g = math.random(1 ,254)
    wait(0.0001)
    local b = math.random(1, 254)
    wait(0.0001)

    local rColor = Color3.fromRGB(r, g, b)

    light.Color = rColor

    print(rColor)
    print(light.Color)
    wait(5)
end
Ad

Answer this question