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

3 comments
Is there a way to restart a loop after breaking it, though? I would imagine that disabling and enabling the script again causes the loop to run again, but in previous testing this does not happen...
Disabling and enabling the script should restart it. You could make a function of the loop and just call it when you feel like starting it.
Thank you! It works very well!