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

How do I fade multiple brick colours from black to white?

Asked by 3 years ago

This script is inside a SurfaceGui.

When I left click it, I want the lights to fade on, and the colour to fade to white.

I have thought about using tweens but at this moment in time I don't understand them enough to use them

script.Parent.MouseButton1Click:connect(function()
  for i,v in pairs(Light) do
    spawn(function()
     for i = 0, 1, .1 do
        v.Color = Color3.fromRGB(0,0,0):Lerp(Color3.fromRGB(255,255,255))
        v.SurfaceLight.Brightness = i
        wait(.01)
            end
        end)
    end
end)

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

This should work hopefully

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)

script.Parent.MouseButton1Click:Connect(function()
    for i, v in pairs(Light:GetChildren()) do
        tweenService:Create(v, tweenInfo, {Color = Color3.fromRGB(255, 255, 255), Brightness = 1}):Play()
        wait(0.01)
    end
end)
Ad

Answer this question