RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a fire alarm system script using modules."
-- Fire Alarm System Module local FireAlarmSystem = {} -- Initialize the Fire Alarm System function FireAlarmSystem.initialize() -- Set up the Fire Alarm System -- Create the alarm sound FireAlarmSystem.alarmSound = Instance.new("Sound") FireAlarmSystem.alarmSound.SoundId = "rbxassetid://1234567890" FireAlarmSystem.alarmSound.Looped = true FireAlarmSystem.alarmSound.Volume = 1 -- Create the alarm light FireAlarmSystem.alarmLight = Instance.new("PointLight") FireAlarmSystem.alarmLight.Color = Color3.fromRGB(255, 0, 0) FireAlarmSystem.alarmLight.Range = 10 FireAlarmSystem.alarmLight.Brightness = 10 -- Create the alarm switch FireAlarmSystem.alarmSwitch = Instance.new("BoolValue") FireAlarmSystem.alarmSwitch.Name = "AlarmSwitch" FireAlarmSystem.alarmSwitch.Value = false -- Connect the alarm switch to the alarm sound FireAlarmSystem.alarmSwitch.Changed:Connect(function(value) if value then FireAlarmSystem.alarmSound:Play() FireAlarmSystem.alarmLight.Enabled = true else FireAlarmSystem.alarmSound:Stop() FireAlarmSystem.alarmLight.Enabled = false end end) end -- Activate the Fire Alarm System function FireAlarmSystem.activate() FireAlarmSystem.alarmSwitch.Value = true end -- Deactivate the Fire Alarm System function FireAlarmSystem.deactivate() FireAlarmSystem.alarmSwitch.Value = false end -- Return the Fire Alarm System Module return FireAlarmSystem