hey how can i deactivate and activate another script from a script?
either remotes or create folder with values in it.
value example
script 1.
local fold = Instance.new("Folder",game.ReplicatedStorage)
fold.Name = "Values"
local val = Instance.new("BoolValue",fold)
fold.Name = "StopIt"
fold.Value = false
wait(5)
fold.Value = true
--other script
local val = game.ReplicatedStorage:WaitForChild("Values"):WaitForChild("StopIt")
val.Changed:Connect(function()
if val.Value == true then
break (loop only)
end
end)
local scriptToDisable = game.ServerScriptService.ScriptName
task.wait(10)
scriptToDisable.Enabled = false
BindableEvents, Remotes and other solutions work fine too as stated above.
You can just use the .Disabled property of the script you want to be disabled
--Script 1
script2.Disabled = true
1 Like
The property is .Disabled , not .Enabled
The Property is .Enabled, not .Disabled.
1 Like
In the property window it says Enabled however I believe both actually work.
1 Like
They added .Enabled a few weeks ago.
1 Like
You can disable a script by doing [script].Disabled = true
; however, I would not recommend doing this this way, but by rather simply structuring your code differently.
1 Like
ohhhhhh i see thanks for the clarification