As cailir said use .disable to disable a script ex:
game:GetService("Workspace"):WaitForChild("Script").disable
One way to share variables between scripts (note: these variables only share through severscript to serverscript so if you want it to go from serverscript to localscript use a RemoteFunction)
You can use a global variable using _G.variable to set the variable do
._G.text = "string"
to retrieve the variable simple do
_G.text
Bonus:
I felt like giving you a little something extra, You learnt Global Variables and now you can learn global functions. For example instead of doing
function idk()
wait(4)
return "idk"
end
You can instead let that be called in any serverscript if its in a serverscript
_G.idk = function()
wait(4)
return(idk)
end
to call this function do
_G.idk()
3 comments
Try using the .disable (at the script that you want to disable)
Right before Script A gets disabled you can create an Int/Object/Number/StringValue that parents to script B then when script B disables itself, you parent the values to script A, vice versa. But thats unecessary
Guys, thanks a lot for your answers!! Especially to Rhytic, that technique is close to what i'm looking for, not unecessary IMO unless there is a better way which i am not aware of at the moment.