Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a way I can disable a script and enable it again using a different script?

There is a property in scripts called disabled that stops your script from working when you enable it in studio, but i cant seem to figure out how to enable it with a script. If I could figure it out I could use it to fix one of the major bugs in my game. Thanks!

4 comments

0

Are you asking how to enable a script through another one? If so then put script.Disabled = false in the other script that will enable it

0

ive tried this in the past but it was with a more complex script, i will try again and update you

1

it worked! tysm!

0

Please edit your post and put [SOLVED] in the title to mark it as solved.

1 answer

Yeah, that's easy! Disabled is a boolean value under local and normal scripts (notice this can't be done with module scripts!) Sample code:

local NEWSCRIPT = Instance.new("Script")
NEWSCRIPT.Parent = game.Workspace
NEWSCRIPT.Name = script
while true do
NEWSCRIPT.Disabled = true --Changed the Bool to true
print('Script was disabled, won't work until disabled is false.')
wait(10)
NEWSCRIPT.Disabled = false --Changed the Bool to false
print('Script was enabled, will work until disabled is checked to true!')
end

Hope this helps! Best regards, 2Loos. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.