I made a script that's supposed to disable a script, as well as its subscripts and sounds inside it, and play a message when the button is clicked.
However, after disabling the script and its contents, it re-enabled it. I want the script to be disabled permanently upon clicking the button.
S1 = game.Workspace.SDS function onClick() S1.Disabled = true S1.SDS2.Disabled = true S1.Alarm0:Stop() S1.Alarm1:Stop() S1.Alarm2:Stop() S1.Alarm3:Stop() S1.Alarm4:Stop() S1.Fire:Stop() S1.movement:Stop() script.Parent.ClickDetector.MaxActivationDistance = 0 local hint = Instance.new("Hint", game.Workspace) hint.Text = "Script Turned Off." end script.Parent.ClickDetector.MouseClick:connect(onClick)
An easy way to do this would be to use a bool value and check if it is true at the beginning of every script. That way you can just have it change the bool value.
I would start the script with an if then statement with a variable that only allows the function to run if its true. Once the script has run once, you can set the variable to false, therefore not allowing the script to run until you make the variable true again.