@Mrattilla (Mrattilla) posted a new topic, subject "Script disable not working". It read:

   Hi guys! 
    
    Why is the script not working well?  
    I searched up on Google about it, but nothing useable information about it, what I've found.  
    And how can I make the aiming more smoother?
    
    So here is a video + a picture and a script:  
    https://doy2mn9upadnk.cloudfront.net/uploads/default/original/4X/f/5/2/f52f52fb109135325900375249efb0dadcfa6c0a.mp4
    [code] 
        --Aim script
        
        local player = game.Players.LocalPlayer
        local mouse = player:GetMouse()
        
        local held = false
        mouse.Button2Down:connect(function(ZoomIn)
             held = true
        	game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView - 15.6
        	game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed - 1
        	script.Parent.Camera.Disabled = false
        end)
        
        mouse.Button2Up:connect(function(ZoomOut)
             held = false
        	game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView + 15.6
        	game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed + 1
        	script.Parent.Camera.Disabled = true
        end)
        
        spawn(function(ZoomIn)
             while true do
                 wait(.5)
             end
        end)
        
    [/code]
    [code] 
        --Created by: ImFarley 
        
        --//THIRD PERSON SHOOTER CAMERA SCRIPT\\--
        
        local uis = game:GetService("UserInputService")
        local ts = game:GetService("TweenService")
        local cam = workspace.CurrentCamera
        local plr = game.Players.LocalPlayer
        local mouse = plr:GetMouse()
        repeat wait() until plr.Character and plr.Character.Parent == workspace
        
        local char = plr.Character
        local hum = char:WaitForChild("Humanoid")
        local waist = char.UpperTorso:WaitForChild("Waist")
        local root = char:WaitForChild("HumanoidRootPart")
        
        hum.CameraOffset = Vector3.new(3, 0, 0)
        hum.AutoRotate = false
        cam.CameraSubject = hum
        
        game:GetService("RunService").RenderStepped:Connect(function()
        uis.MouseBehavior = Enum.MouseBehavior.LockCenter
        local delta = uis:GetMouseDelta()
        local deltaX, deltaY = delta.X, -delta.Y
        cam.CFrame = CFrame.new(cam.CFrame.p, cam.CFrame* CFrame.new(deltaX, deltaY, -2000).p)
        
        local offset = char.LowerTorso.CFrame:ToWorldSpace(CFrame.new(0, char.UpperTorso.Size.Y/2, 0)) * CFrame.fromEulerAnglesXYZ(math.max(math.min(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), .6), -.75), 0, 0) * CFrame.new(0, char.UpperTorso.Size.Y/2, 0)
        
        waist.C1 = offset:inverse() * char.LowerTorso.CFrame * CFrame.new(0, .8, 0)
        
        local tweenInfo = TweenInfo.new(.15, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
        local newRootCF = CFrame.new(root.CFrame.p,root.CFrame.p+Vector3.new(cam.CFrame.lookVector.X,0,cam.CFrame.lookVector.Z))
        local tween = ts:Create(root, tweenInfo, {["CFrame"] = newRootCF}, true)
        tween:Play()
        end)
        
        
    [/code]

Then @blokav (Birdelther) said

    I would try replacing this whole system with something that uses bindables. Disabling/enabling scripts seems like really hacky way to run code from other scripts, and in most cases the same functionality can be achieved with event-driven programming.

So @PitaPata14 (Peter) replied

    in the script all you need to do is find the script using parents for example script.Parent.Parent.Parent.Script and than put this .Disable = true so it can be disabled and .Disabled = false so it can be enable! (IF THATS WHAT U R LOOKING FOR!)

So @Disparrel (Hypnotized) replied

    What's the script output? I can try and help solve this, but what's the current output?

@ScriptingSausage (Oob) replied

    Why are they two different scripts? You should put everything that is currently in the camera script, into the original script. Put it in the button2down function, then delete the empty camera script and delete the parts of the script that disabme and enable the camera script.

So @Mrattilla (Mrattilla) replied

    No errors and nothing in output

So @BaconNosity (CapnFry) replied

    `Script.Disable` doesn't really like to work for some reason, the wiki on it pretty much lies. Here is the wiki for what it should be doing: https://developer.roblox.com/en-us/api-reference/property/BaseScript/Disabled

To which @Apafey (Apafey) replied

    Add some print() to see where the code fails.
    
      * are the “script.Parent.Camera.Disabled = …” lines executed?
      * have you checked if the “Camera” script enabled in the explorer while code is running?
    
    
    
    Generally, I have no problem with setting the Disabled value to true/false.


{'source': 'discourse', 'url': 'https://devforum.roblox.com/t/script-disable-not-working/456847', 'title': 'Script disable not working', 'views': 449, 'has_accepted_answer': False, 'word_count': 635, 'like_count': 6, 'reply_count': 2, 'participant_count': 7, 'posts': 8, 'tags': '', 'author': '@Mrattilla (Mrattilla)', 'participants': '@Mrattilla (Mrattilla), @blokav (Birdelther), @PitaPata14 (Peter), @Disparrel (Hypnotized), @ScriptingSausage (Oob), @BaconNosity (CapnFry), @Apafey (Apafey)', 'image_url': ['//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/4X/6/d/1/6d18e182a1483348ec2438ceb442a18817ad36c1.png'], 'created_at': '2020-02-13T15:09:48.446Z', 'last_posted_at': '2020-02-14T12:36:21.741Z'}