Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to disable and enable back a script?

Asked by
Gigaset39 111
1 year ago
Edited 1 year ago

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...

0
what does the mainGame do? VAnkata20 135 — 1y
0
its the script name. Gigaset39 111 — 1y

1 answer

Log in to vote
1
Answered by 1 year ago

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

0
sorry,but it doesent work. Gigaset39 111 — 1y
0
sorry,but it doesent work. Gigaset39 111 — 1y
0
actualyy,it works,sorry. Gigaset39 111 — 1y
0
that's ok theking66hayday 841 — 1y
Ad

Answer this question