Inside of my gun script I have a code in it that makes your arms move up and down with the mouse. It seems to work fine, but then all of a sudden it stopped letting me fire the gun itself.
I previously fixed it before by using > RenderStepped However, now it doesn’t shoot. I had fixed it by breaking the loop, but now Its really choppy again.
I’ve tried re positioning the script, but it just breaks everything below it if I do not break the loop.
Here is the code: (The code that resets the character when you unequipped the weapon is working fine.)
local function UpdateCharMovement() while RenderStepped:Wait() do if Equipped then local Neck = Character:FindFirstChild("Neck", true) local Arm = Character:FindFirstChild("Right Shoulder", true) local LeftArm = Character:FindFirstChild("Left Shoulder", true) local dir = (Mouse.Hit.p - Character.Head.Position).Unit local angle = math.acos(dir:Dot(Vector3.new(0, 1, 0))) - math.pi/2 angle = math.min(math.max(- math.pi/5, angle), math.pi/5) Neck.C0 = CFrame.Angles(- angle + math.pi/2, math.pi, 0) + Vector3.new(0, Neck.C0.Y, 0) Arm.C0 = CFrame.Angles(- angle, math.pi/2 + math.pi/40 + math.pi/32, math.pi/36) + Vector3.new(Arm.C0.X, Arm.C0.Y, Arm.C0.Z) LeftArm.C0 = CFrame.Angles(- angle, -math.pi/2 - math.pi/40, -math.pi/36) + Vector3.new(LeftArm.C0.X, LeftArm.C0.Y, LeftArm.C0.Z) break end end end