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

My script still runs even when disabled by **Server** script?

Asked by 5 years ago
Edited by Goulstem 5 years ago

Hello, Currently, I'm making a lockdown door that depends on the "Lockdown" value in the "Settings" folder via workspace.

Code:

local Level = script.Parent.Clearance
local r=game:getService("RunService")
local DoorModel = script.Parent
local Door1 = DoorModel.Doors.Door1
local Door2 = DoorModel.Doors.Door2
local Sound = DoorModel.Sound_Folder.Sound_Thing
local ret = Door1.CFrame
local ret1 = Door2.CFrame
local look=Door1.CFrame.lookVector
local Inuse=false

function Open()
    Sound.Lockdown:Play()
    for i=0,math.pi*2,math.pi/31 do
        r.Stepped:wait()
        Door1.CFrame=ret+Vector3.new(-1.53,0,-1.53)*look-math.cos(i)*0.5*look
        Door2.CFrame=ret1-Vector3.new(-1.53,0,-1.53)*look+math.cos(i)*0.5*look
    end
end

while true do
    wait(5)
    if workspace.Settings.Lockdown.Value==true then
        Open()
        wait(5)
        Sound.Lockdown:Stop()
        wait(0.25)
        script.Parent.System.Disabled=true
    elseif workspace.Settings.Lockdown.Value==false then
        Sound.Lockdown:Play()
        Door1.Position= Vector3.new(3.023, 3.81, 0.05)
        Door2.Position= Vector3.new(-3.25, 3.81, 0.05)
        wait(5)
        Sound.Lockdown:Stop()
        wait(0.25)
        script.Parent.System.Disabled=true
    end
end

Any and all help is appreciated at great lengths.

Thank you, Rook

RookPvPz#8960

Edited ~ Tab your code correctly !
0
Can you be more clear? What is the script that is being disabled? What does it do? What should it be doing? etc.. chomboghai 2044 — 5y
0
The script that is currently being ran User#26676 0 — 5y
0
why don't you use a debounce instead of the disable feature, also if you are disabling anything then make sure its archivable is also off greatneil80 2647 — 5y
1
Disabling scripts was never meant to be used in this way. It was just meant for debugging purposes. I'd recommend, as already stated, a debounce. Or, you could use events and disconnect them when they are no longer needed. User#26971 0 — 5y

Answer this question