Hi, so I am trying to use this script what I made but it doesn't work. Please can someone tell me what is wrong.
This was my original code but this works fine.
BoolValue1 = script.Parent.Parent.EmergencyLight1.Toggle
BoolValue2 = script.Parent.Parent.EmergencyLight2.Toggle
BoolValue3 = script.Parent.Parent.EmergencyLight3.Toggle
BoolValue4 = script.Parent.Parent.EmergencyLight4.Toggle
BoolValue5 = script.Parent.Parent.EmergencyLight5.Toggle
BoolValue6 = script.Parent.Parent.EmergencyLight6.Toggle
BoolValue7 = script.Parent.Parent.EmergencyLight7.Toggle
BoolValue8 = script.Parent.Parent.EmergencyLight8.Toggle
Sound1=game.Workspace.Sound1
Sound2=game.Workspace.Sound2
Sound3=game.Workspace.Sound3
Sound4=game.Workspace.Sound4
function onClick()
if BoolValue1.Value == false then
BoolValue1.Value = true
BoolValue2.Value = true
BoolValue3.Value = true
BoolValue4.Value = true
BoolValue5.Value = true
BoolValue6.Value = true
BoolValue7.Value = true
BoolValue8.Value = true
Sound1:Play()
wait(3)
Sound2:Play()
wait(5)
Sound3:Play()
wait(10)
Sound4:Play()
wait(50)
Sound3:Stop()
else BoolValue.Value = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
This is the code what doesn't work right. It will toggle the emergency lights but it won't do anything with the "SpotLight". Also when I press the button it won't turn off.
BoolValue1 = script.Parent.Parent.EmergencyLight1.Toggle
BoolValue2 = script.Parent.Parent.EmergencyLight2.Toggle
BoolValue3 = script.Parent.Parent.EmergencyLight3.Toggle
BoolValue4 = script.Parent.Parent.EmergencyLight4.Toggle
BoolValue5 = script.Parent.Parent.EmergencyLight5.Toggle
BoolValue6 = script.Parent.Parent.EmergencyLight6.Toggle
BoolValue7 = script.Parent.Parent.EmergencyLight7.Toggle
BoolValue8 = script.Parent.Parent.EmergencyLight8.Toggle
*Lights = game.Workspace.Lights.SpotLight*
Sound1=game.Workspace.Sound1
Sound2=game.Workspace.Sound2
Sound3=game.Workspace.Sound3
Sound4=game.Workspace.Sound4
function onClick()
if BoolValue1.Value == false then
BoolValue1.Value = true
BoolValue2.Value = true
BoolValue3.Value = true
BoolValue4.Value = true
BoolValue5.Value = true
BoolValue6.Value = true
BoolValue7.Value = true
BoolValue8.Value = true
* Lights.SpotLight = 0*
Sound1:Play()
wait(3)
Sound2:Play()
wait(5)
Sound3:Play()
wait(10)
Sound4:Play()
wait(50)
Sound3:Stop()
else BoolValue.Value = false
Lights.SpotLight = 0
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
PS: I put * * To show where the broken code is.
Please help asap.
Thanks.
