Changing camera back to normal

So basically, I have this script where it changes your camera position for the gun to look cool, right? So it changes the camera to this:

local UserInputService = game:GetService("UserInputService")
        local RunService = game:GetService("RunService")

        local plr = game:GetService("Players").LocalPlayer
        local char = script.Parent.Parent
        local hum = char:WaitForChild("Humanoid")
        local root = hum.RootPart 



        hum.AutoRotate = false
        game.StarterPlayer.CameraMaxZoomDistance = 7
        game.StarterPlayer.CameraMinZoomDistance = 3.5

        hum.CameraOffset = Vector3.new(3.00,1.00,0)
        game:GetService("RunService"):BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
            game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter 

            local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() 
            root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0)
        end)

And now I try change it back to normal, I have no idea how

local UserInputService = game:GetService("UserInputService")
    local RunService = game:GetService("RunService")

    local plr = game:GetService("Players").LocalPlayer
    local char = script.Parent.Parent
    local hum = char:WaitForChild("Humanoid")
    local root = hum.RootPart 



    hum.AutoRotate = true
    game.StarterPlayer.CameraMaxZoomDistance = 20
    game.StarterPlayer.CameraMinZoomDistance = 3.5

    hum.CameraOffset = Vector3.new(0,0,0)
    game:GetService("RunService"):BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
        game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default

        local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() 
        root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0)
    end)

image

Do you mind showing a video/clip of “normal” and “unnormal”?

https://gyazo.com/86930b59c1a12581e57ae58c2d3d695c

Normal is meant to be the deafult roblox camera basically.

Add prints to when it “resets” to make sure it’s actually ran, I don’t see how it wouldn’t work if it did run

I put a print in the script and it seems to not run…

Ok atleast we know it’s not the code then… Where is the script located?

The script is located in the weapon

The “ShiftLock” which is bound to RenderStep still runs modifying the HumanoidRootPart, so you have to unbind it.

game:GetService("RunService"):UnbindFromRenderStep("ShiftLock")
1 Like