|
I am making a police lightbar and i know how to make it flash and change, i am stumped on how to put a button and have it light up all of the individual lights as one. i have lettered all of the lights and have it built, Please help ASAP.
|
|
|
Stay calm, first insert a ClickDetector into the part you want to use to activate the lights, then add this.
for _,v in pairs(Workspace.LightBar:GetChildren()) do
if v.Name == "Light" then
v.BrickColor = BrickColor.new()
end
end
Modify this to work with your script. |
|
|
Could you explain this as if i have no idea what im doing? like lets say i want it to do This (below) to a pointlight
wait(.15)
Light.Brightness = 10
wait(.15)
Light.Brightness = 0
i want the script to make that loop once the button is pushed and stop once i push the button again |
|
|
Alright, tell me the name of the bricks and the models. |
|
|
Model name Is "LightBar" And the Colors in the () are NOT in the name of the parts, i just gave you colors for reference. :D Thanks man.
A(RED)
B(RED)
D(RED)
E(NAVY BLUE)
G(NAVY BLUE)
H(NAVY BLUE)
I(NAVY BLUE)
J(NAVY BLUE)
K(NAVY BLUE)
L(NAVY BLUE)
M(NAVY BLUE)
O(NAVY BLUE)
P(RED)
R(RED)
S(RED)
T(RED)
U(RED)
V(RED) |
|
|
Could've made this much more efficiently however hopefully you'll enjoy this.
while wait() do
for _,v in pairs(game.Workspace.LightBar:GetChildren()) do
if v.Name == "A" or "B" or "D" or "P" or "R" or "S" or "T" or "U" or "U" or "V" or "D" then v.BrickColor = BrickColor.Red()
elseif v.Name == "E" or "G" or "H" or "I" or "J" or "K" or "L" or "M" or "N" or "O" then v.BrickColor = BrickColor.new("Navy blue")
wait(.15)
Light.Brightness = 10
wait(.15)
Light.Brightness = 0
end
end
end
--Could've probably simplified this however otherwise if you have any other questions feel free to inform me and enjoy hopefully. |
|
|
Thank you SO much, and do i keep the lights enabled or disabled? |
|
|
|
Uhh when i put it in all it does is make everything red on the lightbar
|
|
|
Is there any way i can send you the light bar as a file? so you can look at it? |
|
|
I have to get off so can i PM you in the morning? |
|
|
I can just send you a message with the script then. |
|