I would like when the alarm starts together with the isolation the text of the displays showing the status change from “There are no updates” to “Zone in isolation” but at first I have no problems, then when I start the alarms (Starting a remotevent) I get the following problem “ServerScriptService.AlarmManager:17: attempt to index nil with ‘Text’ - Server - AlarmManager:17”
I’ve already tried moving the position of the lines of the scripts and I’ve already tried using if Info:IsA(“TextLabel” then, but nothing changed, thanks for anyone who even reads.
Script:
local Valore = game.Workspace.Luci.CDC.Celle1.Allarmi.Value
local megafono = nil
local AllarmeBase = nil
local PreaAnnuncio = nil
local IsolamentoCDC = nil
local Isolamento = true
local MessaggioIsolamento = "The Class D containment area is currently in isolation."
local MessaggioStandard = "There are no updates for your clearance level."
-- Computer
local Cservice = game:GetService("CollectionService")
local function ChangeStatus(Infos)
if Isolamento then
Infos.Text = MessaggioIsolamento
else
Infos.Text = MessaggioStandard
end
end
for _, Infos in pairs(Cservice:GetTagged("Status")) do
ChangeStatus(Infos)
end
-- Megafoni
for i,v in pairs(game.Workspace.Luci.CDC.Celle1.Allarmi.Megafoni:GetChildren()) do
if v.Name == "Megafono" then
megafono = v
for i,audio in pairs(megafono:GetChildren()) do
if audio.Name == "AllarmeBase" then
AllarmeBase = audio
elseif audio.Name == "PreAnnuncio" then
PreaAnnuncio = audio
elseif audio.Name == "IsolamentoCDC" then
IsolamentoCDC = audio
end
end
end
end
function AccendiAllarmiCDC()
if Valore.Value == 1 then --1 (base)
ChangeStatus()
Valore.Value = 0 -- 0 (Acceso)
Isolamento = true
game.ReplicatedStorage.ChangeText:FireAllClients()
AllarmeBase.Volume = 1
AllarmeBase:Play()
task.wait(1)
PreaAnnuncio:Play()
task.wait(1.6)
IsolamentoCDC:Play()
local WarningLightsCDC ={}
for i,v in pairs(workspace.Luci.CDC.Celle1.Allarmi:GetChildren())do
if v.Name=="Allarme" then
table.insert(WarningLightsCDC,v)
end
end
for i,WarningLight in pairs(WarningLightsCDC) do
WarningLight.Toggle.Value = true
Valore.Value = 2 --
end
end
task.wait(50)
SpegniAllarmiCDC()
end
function SpegniAllarmiCDC()
Isolamento = false
ChangeStatus()
task.wait()
game.ReplicatedStorage.ChangeText:FireAllClients()
AllarmeBase.Volume = 0
Valore.Value = 0
local WarningLightsCDC ={}
for i,v in pairs(workspace.Luci.CDC.Celle1.Allarmi:GetChildren()) do
if v.Name=="Allarme"then
table.insert(WarningLightsCDC,v)
end
end
for i,WarningLightsCDC in pairs(WarningLightsCDC)do
WarningLightsCDC.Toggle.Value = false
Valore.Value = 1
end
end
--Accendere
game.ReplicatedStorage.Allarmi.Start.AllarmeGenerale.OnServerEvent:Connect(AccendiAllarmiCDC)
game.ReplicatedStorage.Allarmi.Start.AllarmiCDC.OnServerEvent:Connect(AccendiAllarmiCDC)
--Spegenere
game.ReplicatedStorage.Allarmi.Stop.AllarmiCDC.OnServerEvent:Connect(SpegniAllarmiCDC)
game.ReplicatedStorage.Allarmi.Stop.AllarmeGenerale.OnServerEvent:Connect(SpegniAllarmiCDC)
Screenshots:
Thanks in advance for your answers!