Hello
I am currently working on a game called “Classrooms,” a first person horror adventure game. I am currently scripting a fire alarm thing for the classrooms that will activate and deactivate with a number value. When I change the value to 0, I expect the alarm to stop, but the while true do loop breaks and the sound continues. I need help.
This here is my code if you need it (Ignore the typos)
if script.Parent.Alarm_Activated.Value == 1 then
while true do
script.Parent.Lieght.Material = Enum.Material.Neon
script.Parent.Lieght.Fire_1.Enabled = true
script.Parent.Lieght.Fkre_2.Enabled = true
script.Parent.Glass.Material = Enum.Material.Neon
script.Parent.Glass.Transparency = 0
task.wait(0.11)
script.Parent.Lieght.Material = Enum.Material.SmoothPlastic
script.Parent.Lieght.Fire_1.Enabled = false
script.Parent.Lieght.Fkre_2.Enabled = false
script.Parent.Glass.Material = Enum.Material.Glass
script.Parent.Glass.Transparency = 0.5
task.wait(1)
if script.Parent.Alarm_Activated.Value == 0 then
break
end
if script.Parent.Alarm_Activated.Value == 0 then
script.Parent.Speaker.Actual_Alarm:Stop()
script.Parent.Lieght.Material = Enum.Material.SmoothPlastic
script.Parent.Lieght.Fire_1.Enabled = false
script.Parent.Lieght.Fkre_2.Enabled = false
script.Parent.Glass.Material = Enum.Material.Glass
script.Parent.Glass.Transparency = 0.5
end
end
end
View the DevLog for Classrooms: Working on a Game! | DevLog - #16 by TotallyBlackwolf