So, I've been working on a vehicle's emergency lighting for the last few days and it works well in an empty game, but in live use it tends to get quite slow in the emergency lights. The coding essentially involves going light by light and telling it to be on or off. Is there a more efficient way to do this?
lightbar.part1.Enabled = true
lightbar.part2.Enabled = false
multiply that by about 20 for every single section of the pattern (tends to have 5-6 different sections)
If you don't really understand what I mean, I am trying to make a emergency lightbar with realistic emergency patterns... look up emergency lighting patterns
For example, here is how it is in the live server: https://gyazo.com/74045ad0678d5293d5be7a0d1b7f044f
And this is what it should look like: https://gyazo.com/74045ad0678d5293d5be7a0d1b7f044f
function turnLightOff(IDs, a, original)
for k,v in pairs(a) do
for l,x in pairs(IDs) do
if v.Name == x then
v.Lighto.Enabled = true
else
v.Lighto.Enabled = false
end
end
end
end
turnLightOff({"B2","R1","R3","B13","B15","R12","R14"}, MainVeh:GetChildren())
wait(10)
turnLightOff({"B1","B3","R2","B12","B14","R13","R15"}, MainVeh:GetChildren())

3 comments
use a for loop
im so confused what hes asking for some reason
Can't use a for loop as some go off and some go on... I am trying to find a more efficient way to turn a lot of lights on and off at the same time.