Why the Child objects move seperatly from parent?

I have a gun and i am making a gun script but the problem i am having is that the children are moving seperatly. For example the clip and the inside are moving differently. The gun isnt staying together. This is my SetUp:

-Player
  -mainCamera
    -Glock
      -glock 19
        -glock_19
        -glock_19_sl
        -glock_19_mg

my playermovement scirpt is:

public float walkSpeed = 5;
	public float runSpeed = 10;
	private float movementSpeed = 5;
	public float mouseSensitivity = 2;
	private float verticalRotation = 0;
	public float upDownRange = 60;
	
	private float verticalVelocity = 0;
	private CharacterController controller;
	
	public float jumpSpeed = 20;
	
	
	void Start () 
	{
		movementSpeed = walkSpeed;
		controller = GetComponent<CharacterController>();

	}
	
	void Update () 
	{
		// Rotation
		
		float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
		transform.Rotate(0, rotLeftRight, 0);
		
		verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
		verticalRotation = Mathf.Clamp(verticalRotation, -upDownRange, upDownRange);
		Camera.main.transform.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
		
		if (Input.GetKey(KeyCode.LeftShift))
		{
			movementSpeed = runSpeed;
		}else{
			movementSpeed = walkSpeed;
		}
		
		
		// Movement
		
		float forwardSpeed = Input.GetAxis("Vertical") * movementSpeed;
		float sideSpeed = Input.GetAxis("Horizontal") * movementSpeed;
		
		if (controller.isGrounded)
		{
			if (Input.GetButtonDown("Jump"))
			{
				verticalVelocity = jumpSpeed;
			}
		}else{
			verticalVelocity += Physics.gravity.y * Time.deltaTime;
		}
		
		Vector3 speed = new Vector3(sideSpeed, verticalVelocity, forwardSpeed);
		
		speed = transform.rotation * speed;
		
		controller.Move(speed * Time.deltaTime);
	}

this script is only on the player. This is the only script or component on any of the objects.

why are the glock_19, the glock_19_sl, and the glock_19_mg moving seperatly from the Glock? They are children but are still moving seperatly. Why?

I agree with b1gry4n, the issue is probably with your setup not your code.

Here are some troubleshooting steps.

  1. Make sure there is no rigidbodys on the items (You have said this but I thought I should say for others).
  2. Look to see if there is any animations on the model, animations should be fine and will work relative to the parent but if they are broken you will see the problem.
  3. Use (new) unity primitives to block out the same scenario and see if the problem is still there ( this will show you if it is your gun or something else that has broken).
  4. Look at the flags on the game objects, are any static?
  5. Are the transforms non-uniformly or reverse scaled? (This is more often an issue with colliders and physics)
  6. Make very VERY sure that no other scripts are messing with your game objects, remember you don’t need to have a script on a object for it to modify it, other scripts can drive game-objects by references. This step is why we do step 3, with new objects blocking out the issue there won’t be any scripts acting on them.

If none of these are the issue then make a new project and put just what you need to recreate the issue and log a bug with unity.