My goal is to load the intercom sound with the sfx variable. The name is changing to “Loading SFX” but isn’t going past that.
chimes=workspace.ASAS_Chimes
intercom=workspace.Intercom
local asas = {}
function asas.intercomSfx(line)
local sfx=nil
-----Automatic Smart Announcement System chimes-----
if line=="pm" then
sfx=chimes.PM_PM_ASAS
elseif line=="bap" then
sfx=chimes.BAP_BAP_ASAS
-----Military Announcement System chimes-----
elseif line=="dbb" then
sfx=chimes.DISTORTED_BAP_BAP_ASAS
elseif line=="R" then
sfx=chimes.REG_MAS
elseif line=="H" then
sfx=chimes.HIGH_MAS
elseif line=="M" then
sfx=chimes.MED_MAS
elseif line=="M3" then
sfx=chimes.MED_MAS_3T
elseif line=="L" then
sfx=chimes.LOW_MAS
else
warn(line,"intercom sfx not found")
end
intercom.Name="Loading SFX"
intercom=sfx
intercom.Loaded:Wait()
intercom.Name="Intercom"
end
function asas.intercomTrack(line,sfx)
if type(line)~="string" then
warn("Line must be a string")
return
end
local voice=workspace:FindFirstChild(line)
if not voice then
warn(line,"voice line not found")
return
end
asas.intercomSfx(sfx)
intercom.Ended:Wait()
voice:Play()
end
return asas
how its being required & called:
ASAS=require(script.AutomaticSmartAnnouncementSystem)
ASAS.intercomTrack("kaboom0","H")