I'm working on a script for a game, and the script won't disable itself as needed for proper functionality in the game. That print message in the end of the if statement ends up happening after the script should be disabled. I have also tried making other scripts disable this one, and checked all other scripts for something enabling it, but it just doesn't disable. It continues to run when it should not.
if Temp.Value >= MeltdownUpperLimit then Status.Value = "Meltdown" Warn.Value = "Core Meltdown Imminent! Evacuate Now!" script.Parent.Parent.Parts.Core.PointLight.Color = Color3.fromRGB(255,0,0) script.Parent.Parent.Parts.Core.BrickColor = BrickColor.new("Really red") script.Parent.Meltdown.Disabled = false script.Parent.ExplosionSounds.Disabled = false script.Disabled = true print("Bug Test: gamne.Workspace.Core.Scripts.TempIncrementing: Line 133; Script Not Disabled as Expected.") --This is meant to be line 133 in the script. end
Disabling the script wont terminate the current thread (the wiki is wrong). If you want the script to end you could return or break if it is a loop (and disconnecting events not sure about this one).
if Temp.Value >= MeltdownUpperLimit then Status.Value = "Meltdown" Warn.Value = "Core Meltdown Imminent! Evacuate Now!" script.Parent.Parent.Parts.Core.PointLight.Color = Color3.fromRGB(255,0,0) script.Parent.Parent.Parts.Core.BrickColor = BrickColor.new("Really red") script.Parent.Meltdown.Disabled = false script.Parent.ExplosionSounds.Disabled = false --script.Disabled = true return --print("Bug Test: gamne.Workspace.Core.Scripts.TempIncrementing: Line 133; Script Not Disabled as Expected.") --This is meant to be line 133 in the script. end