wait(1)
local act = _G.actvalue -- The global value
local inuse = false -- This is neccecary only for the script to not break and stuff, this needs to remain false.
_G["ALightsToggled"] = true
function alarmchange(alert)
if not inuse then
inuse = true
if _G.actvalue == "Inactive" then
local c = script.Parent:GetChildren()
for i = 1, #c do
if c[i].Name == "LightPart" then
if c[i]:FindFirstChild("PointLight") ~= nil then
c[i].PointLight.Brightness = 1
elseif c[i]:FindFirstChild("SpotLight") ~= nil then
c[i].SpotLight.Brightness = 1
elseif _G.actvalue == "Red" then
local c = script.Parent:GetChildren()
for i = 1, #c do
if c[i].Name == "LightPart" then
if c[i]:FindFirstChild("PointLight") ~= nil then
c[i].PointLight.Brightness = 0.4
elseif c[i]:FindFirstChild("SpotLight") ~= nil then
c[i].SpotLight.Brightness = 0.4
end
end
end
end
end
_G["AToggleLights"] = function()
if _G["ALightsToggled"] == true then
local c = script.Parent:GetChildren()
for i = 1, #c do
if c[i].Name == "LightPart" then
if c[i]:FindFirstChild("PointLight") ~= nil then
c[i].PointLight.Enabled = true
c[i].BrickColor = BrickColor.new(226)
elseif c[i]:FindFirstChild("SpotLight") ~= nil then
c[i].SpotLight.Enabled = true
c[i].BrickColor = BrickColor.new(226)
end
end
end
elseif _G["ALightsToggled"] == false then
local c = script.Parent:GetChildren()
for i = 1, #c do
if c[i].Name == "ALightPart" then
if c[i]:FindFirstChild("PointLight") ~= nil then
c[i].PointLight.Enabled = false
c[i].BrickColor = BrickColor.new(1003)
elseif c[i]:FindFirstChild("SpotLight") ~= nil then
c[i].SpotLight.Enabled = false
c[i].BrickColor = BrickColor.new(1003)
end
end
end
end
end
COMMUNITY QUESTION
Please help me Mikeh?
1 answer
It seems that you have the incorrent amount of 'ends' needed. Quick Fix:
function alarmchange(alert)
if not inuse then
inuse = true
if _G.actvalue == "Inactive" then
local c = script.Parent:GetChildren()
for i = 1, #c do
if c[i].Name == "LightPart" then
if c[i]:FindFirstChild("PointLight") ~= nil then
c[i].PointLight.Brightness = 1
elseif c[i]:FindFirstChild("SpotLight") ~= nil then
c[i].SpotLight.Brightness = 1
elseif _G.actvalue == "Red" then
local c = script.Parent:GetChildren()
for i = 1, #c do
if c[i].Name == "LightPart" then
if c[i]:FindFirstChild("PointLight") ~= nil then
c[i].PointLight.Brightness = 0.4
elseif c[i]:FindFirstChild("SpotLight") ~= nil then
c[i].SpotLight.Brightness = 0.4
end
end
end
end
end
end
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You're not suppose to request help from just one person. Please post any errors or what you're trying to do including a question that tells other what you problem is.