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

How to disable and enable back a script?

Hi i created a part that when u click it disable a script that contains the ”MainScript”, and it works, but.. it just that when i enable the script, the script woldnt work, do u guys know why? :D i use this script to”close it”:

       MainGame = game.ServerScriptService.MainGame
function onClick(click)
  	wait(0.5)
MainGame.Disabled = true

end

script.Parent.ClickDetector.MouseClick:connect(onClick)

and to ”open it” :

MainGame = game.ServerScriptService.MainGame
 function onTouch(hit)
wait(0.5)
MainGame.Disabled = false

end

script.Parent.Touched:connect(onTouch)

but,as i sayd, when you ”open it” it woldnt work...

2 comments

0

what does the mainGame do?

0

its the script name.

1 answer

✓ Accepted answer

Try disabling the script, then in your script enable it when it is clicked that should work I think.

4 comments

0

sorry,but it doesent work.

0

sorry,but it doesent work.

0

actualyy,it works,sorry.

0

that's ok

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