Trying to fix lights’ “Dimming Effect” #2

I want to make the lights to have dimming effects, but because that this is a loop command, it actually loops the “dimming” too, causing some kind of seizure effects, any alternatives?

Here’s how it works
the script below are located inside a folder together with these models called “Minis###”. Example, Mini001, Mini002 and so on.

local MinIndex = 1
local MaxIndex = 84
local CurrentIn = 0
local Path = game.Workspace.Minis.Ring4


for current = MinIndex, MaxIndex do
	CurrentIn = CurrentIn + 1
	local Names = "Mini000"
	if CurrentIn < 10 then
		Names = "Mini00"..CurrentIn
	else
		Names = "Mini0"..CurrentIn
	end

	local lights = Path[Names].lights
	local water = Path[Names].Main.Nozzle.Water
	local refill = Path[Names].Main.Nozzle.Refill

	water:GetPropertyChangedSignal("Enabled"):Connect(function()
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = 0
			bulb.light.Enabled = true
			bulb.Material = "Neon"
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .1
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .3
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .5
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .7
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = 1
		end
	end)
	refill:GetPropertyChangedSignal("Enabled"):Connect(function()
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = 1
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .7
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .5
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .3
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Brightness = .1
		end
		task.wait(.2)
		for _, bulb in ipairs(lights:GetChildren()) do
			bulb.light.Enabled = false
			bulb.Material = "Glass"
		end
	end)
end

image

Inside these models there are
“Main.Nozzle.Water”
“Main.Nozzle.Refill”
“lights.bulb.light” (4 of them)
On another folder, there’s a button inside a surfacegui that Enables “Water” for .7 second then disable it
^ after 3 seconds of that happening, Refill will be enabled and turn off after .3 second.

What i tried is that i want to well, trying the dimming effect i mentioned (just like the the halogens at dubai fountain, 171003 Dubai - Burj Fountain Video - YouTube).
The Lights would slowly getting brighter when Water’s enabled till it reaches the brightness of 1. Once refill has been enabled, it will slowly getting dimmer till it reaches 0.

I asked this problem on forum days ago but there wasn’t much help, if you know how to fix this then it would be lovely!

1 Like