Made the leg IK bone, tried to attach the upper leg bone to the pelvis but after attaching it, the body rotates a little bit I'm relatively new at rigging in Blender, and I tried to rig a humanoid model that I made. Everything went fine, but after finishing the leg IK bone, I tried to attach the upper leg bone to the lower pelvis bone to allow the model to crouch. But after attaching both leg bone to the lower pelvis bone and going to pose mode, the model and the rig was slightly rotated clockwise. When I lowered the lower pelvis bone to make the model crouch, the model leaned to one side and not the middle.
 Here is a copy of my .blend file of my model before attaching the leg to the pelvis: Character
Any kind of help will be appreciated.
In Pose mode, select your right lowerleg, go into Properties > Bone Constraints, and in your IK Constraint, change the Chain factor from 0 (influence the whole armature) to 2 (only influence 2 bones)