Whenever someone speaks, there needs to be punctuation inside the quotation marks. This is how to use the different types of punctuation.
Generally in dialogue, there should be a "," at the end of a sentence inside the punctuation marks. This is the case in just about every situation. Here are some examples:
"That store sells candy," she said with a grin.
"I really hate school," Jake muttered.
"Pokémon training looks like fun," the old man commented.
Notice also how the first word after the dialogue isn't capitalized. That's because it's like each line is one sentence; ignore the quotation marks for a moment. It doesn't really make sense if you just say "I really hate school." and "Jake muttered." as two different sentences, because they don't really make a lot of sense if they're alone. They only make sense when they’re connected, because they rely on one another for clarity.
Another time you use a comma is if someone is being addressed. That means if one character is talking to another character, there should be a comma before or after their name (depending). Examples:
"Hello, Jake," said Robert.
"Here, Jackie, I wanted to give this to you," Alex said shyly as he gave her a pretty rose.
"Do you like chocolate, Rebecca?" her grandmother asked.
This goes at the end of every sentence. However, if you have dialogue and you want to start a new sentence after the dialogue, you can put a period inside the quotation marks. This means that each sentence can stand alone and would still make sense without the other. Remember to capitalize the next word! Example:
"You’re pretty." She smiled up at the supermodel.
The Question Mark:
"I hate you." The little girl crossed her arms and walked away.
"I wish I could become a Pokémon trainer." His mind filled with possibilities at the very thought of it.
"Yes, I would like a piece of cake, please." Without even waiting his turn, little Johnny plunged his hand into the birthday cake and grabbed some for himself.
Whenever somebody asks a question, put a "?" at the end of the sentence. It is not replacing a period here, so the word after the dialogue wouldn't be capitalized. Example:
"Is it going to rain today?" the boy asked.
The Exclamation Mark:
"Can I have a blue one?" she requested of the balloon salesman.
"Do you like ice cream? My family really likes ice cream," Sonia said happily.
Put a "!" at the end of a sentence when somebody has shouted something, or possibly given a strict command. Again, if it's at the end of dialogue, the word after the quotation marks usually shouldn't be capitalized. Example:
"I want a pony!" the little girl screamed.
"Go to your room, Jessie! You were a very bad boy," the mother said angrily.
"Let's go to the carnival!" he cried giddily.