A little help with light strobe script

hello, devforum. i was modifying and adding new stuff into a random concert light system (dont ask why) and im kind of stuck trying to add another strobe function.

local Epic = script.Parent

function onClick()
	local led = game.Workspace:GetChildren("LED1")
	led = led[math.random(1, #led)]

	spawn(function()
		while true do
			led.LED.Transparency = 0
			led.LED.SurfaceLight.Brightness = 1
			led.LED.Beam.Transparency = NumberSequence.new(0.5, 0.5)
			wait(0.002)
			led.LED.Transparency = 1
			led.LED.SurfaceLight.Brightness = 0
			led.LED.Beam.Transparency = NumberSequence.new(1, 1)
			wait(0.002)
		end
	end)
end
Epic.MouseButton1Click:connect(onClick)

the error:
15:28:59.347 LED is not a valid member of Model "Workspace.Model"

1 Like

Send a picture of your explorer where all the LED’s are

But also other things seperate from the solution that you should take into note:

  • don’t use ‘:connect’ because it is deprecated use :Connect instead
  • use coroutine.create() instead of spawn() because coroutine has no delay on starting.
  • GetChildren is not meant to have any arguments

here

Yeah the problem is you are not using GetChildren correctly. The first model is tries to use is “Dummy” which does not have the LED object in. I would recommend putting all of the LED’s into a folder that is seperate from the workspace

oops. thanks for telling me!

chars…

But yeah just change the

game.Workspace:GetChildren("LED1")

Into

game.Workspace.Lights:GetChildren()

And put all the LED’s into a folder called “Lights” in the workspace.

edit: nvm

characters again…