Before I teach you the rules of soccer, you will need to understand how soccer works.
The first thing you need to know is that if a ref gives out a red card to a player that player can no longer play, and that team has to play with one less player.
If a ref gives out a yellow card to a player that means that player gets a warning and can still play. If that same play gets another yellow the ref switches the two yellow for a red and that person is taken out of the game.
Now I will teach you the difference between red and yellow cards.
You can get a yellow card for Unsporting behavior, dissent by words or actions, persistently breaking rules, delaying the restart of play, defenders failing to stay the proper distance from free kicks corner kick throw in, entering or reentering the field without the refs permission, or deliberately leaving the field without refs permission.
You can get red cards for serious foul play, violent conduct, spitting at anyone, deliberately touching the ball with your hand, fouling a player to prevent an obvious goal, or two yellow cards in one game.