Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.