so what i have tried to do is to make the lights loop blink when the value is over 100 and deactivate later, im only good at modeling so this is a nightmare
local lights = script.Parent.Model.LEDIN.LEDS:GetChildren() workspace.TEMP.Changed:Connect(function() if workspace.TEMP.Value > 100 then while wait() do for _,child in pairs(lights) do BrickColor.new("Institutional white") Material = Enum.Material.Neon wait(1) BrickColor.new("Dark grey") Material = Enum.Material.SmoothPlastic wait(1) end end end
Hey. Just one thing, don't create a new loop every time the value changes or its gonna result in chaos.
local lights = script.Parent.Model.LEDIN.LEDS:GetChildren() local tempvalue = 0 workspace.TEMP.Changed:Connect(function(value) tempvalue = value -- value that holds the "TEMP" value so you can use it for later end) spawn(function() -- spawn allows for the code to run in serial, this way, you can write more code under while wait() do if tempvalue <= 100 then continue end -- moves onto next iteration if tempvalue is less than or equal to 100 for _,child in pairs(lights) do spawn(function() -- serial again, so every led blinks at the same time, or if thats not the effect you're going for child.Color = BrickColor.new("Institutional white") child.Material = Enum.Material.Neon wait(1) child.Color = BrickColor.new("Dark grey") child.Material = Enum.Material.SmoothPlastic wait(1) end) end end end)
You can make a variable change every time the lights blink and use repeat wait() until variable == Number for the light blinking system. while wait() do makes it so that they blink until the server shuts down.
-Ducky
Developer
Youtuber