Back to Blog
Coding for Kids

Build a Simple Chatbot in Scratch (Ages 9–12) — Step-by-Step with AI Help

A scratch chatbot tutorial for kids ages 9–12: build a simple chatbot, add smart replies, and use AI help for Scratch projects safely.

Build a Simple Chatbot in Scratch (Ages 9–12) — Step-by-Step with AI Help
March 6, 2026
9 min read
#Scratch#Chatbots#Projects

What your child will build (and why it’s a great first chatbot)

A chatbot is a program that “talks back” using rules you create. In this Scratch chatbot tutorial for kids (ages 9–12), your child will build a simple, friendly bot that:

  • Greets the user and asks their name
  • Responds to a few common questions (like “help,” “joke,” or “how are you?”)
  • Uses a simple “brain” of keywords (so it feels smart)
  • Includes a fallback response when it doesn’t understand

Why parents love this project: it’s short, creative, and teaches real coding thinking—inputs, outputs, conditions, variables, and debugging—without feeling like homework.

By the end, your child will be able to say, “I know how to make a chatbot in Scratch,” and you’ll see them practicing:

  • Reading and writing logic (If the user says X, do Y)
  • Designing a conversation (what should the bot ask next?)
  • Iterating (test, fix, improve)

Before you start: setup + conversation plan

Open Scratch (online or desktop) and start a new project. You can use the default cat, or choose a character that fits your bot (robot, alien, librarian—anything works).

What you’ll need in Scratch

  • A sprite (your chatbot character)
  • A backdrop (optional, but fun)
  • A variable to remember the user’s name
  • A plan for 5–8 responses

A quick “chatbot script” (kid-friendly planning)

Before coding, write the mini script your bot should handle. Here’s a simple starter set your child can copy:

  • If user says “hi” or “hello” → greet them
  • If user says “help” → explain options
  • If user says “joke” → tell a joke
  • If user says “how are you” → respond politely
  • If user says “bye” → say goodbye
  • Otherwise → “I’m not sure I understand. Try: help, joke, or bye.”

Actionable phrase bank (use this as your chatbot’s “vocabulary”)

Use this table to help your child choose keywords and responses. The key idea: Scratch can check whether the message contains a word or phrase.

What the user might type Keywords to check (contains) Bot response idea
“hi”, “hello”, “hey” hi, hello, hey “Hi! What’s your name?”
“help” help “Try typing: joke, how are you, or bye.”
“tell me a joke” joke “Why did the computer sneeze? It had a virus!”
“how are you?” how are you “I’m doing great—thanks for asking!”
“bye”, “goodbye” bye, goodbye “Bye! Come chat again soon.”

Parent tip: Let your child write at least one response that matches their personality. When kids “own” the character, they stick with the project longer.

Step-by-step: how to make a chatbot in Scratch

This build uses simple Scratch blocks: ask, answer, if/else, variables, and a forever loop.

Step 1: Create a variable for the user’s name

  1. Go to VariablesMake a Variable.
  2. Name it: name (for all sprites).

Step 2: Start the conversation (greeting + name)

On your chatbot sprite, add:

  • Eventswhen green flag clicked
  • Lookssay "Hi! I’m ChatBuddy." for 2 seconds
  • Sensingask "What’s your name?" and wait
  • Variablesset [name v] to (answer)
  • Lookssay (join "Nice to meet you, " (name)) for 2 seconds

Now your bot remembers the user’s name.

Step 3: Make a chat loop (so the conversation continues)

Add:

  • Controlforever
    • Sensingask (join "What do you want to talk about, " (name)) and wait
    • (We’ll add the “brain” next)

This “forever” loop is what makes it feel like a real chatbot.

Step 4: Add the chatbot “brain” using keyword checks

We’ll check what the user typed using Operators blocks.

Inside the forever loop, add an if / else if style chain. Scratch doesn’t have “else if” directly, so you’ll nest if else blocks.

  1. First check greetings:
  • Controlif < > then else
  • Condition (use Operators):
    • < ( (answer) contains "hello" ) or ( (answer) contains "hi" ) >
  • Then:
    • Lookssay (join "Hello, " (name)) for 2 seconds
  1. In the else part, add another if else for help:
  • Condition: < (answer) contains "help" >
  • Then: say "Try: joke, how are you, or bye." for 3 seconds
  1. Add another nested if else for joke:
  • Condition: < (answer) contains "joke" >
  • Then: say "Why did the computer sneeze? It had a virus!" for 3 seconds
  1. Add another nested if else for feelings:
  • Condition: < (answer) contains "how are you" >
  • Then: say "I’m doing great—thanks for asking!" for 2 seconds
  1. Add another nested if else for goodbye:
  • Condition: < ( (answer) contains "bye" ) or ( (answer) contains "goodbye" ) >
  • Then:
    • say (join "Bye, " (name)) for 2 seconds
    • Optional: stop the project with Controlstop [all v]
  1. Final fallback (the last else):
  • say "I’m not sure I understand. Type 'help' for ideas." for 3 seconds

That’s it—your Scratch chatbot is alive.

Step 5: Make it feel smarter (small upgrades that matter)

These quick tweaks take the project from “basic” to “wow.”

  • Add more keywords for the same idea:
    • For jokes, check “funny” too.
    • For greetings, check “hey.”
  • Use the name more often:
    • “Great question, (name)!”
  • Add a ‘menu’ command:
    • If the user types “menu,” the bot lists options.

If your child wants a challenge: create a variable called mood and let the user choose “happy,” “bored,” or “curious,” then change responses based on that.

AI help for Scratch projects: how to use it safely and effectively

Kids often get stuck on phrasing, logic, or “what should my bot say next?” This is where AI help for Scratch projects can be useful—if you use it like a coach, not a copy machine.

The best way to ask AI for help (copy/paste prompts)

Encourage your child to ask specific questions. Here are prompts that work well:

  • “I’m making a Scratch chatbot. I want it to respond when the user types ‘joke’ or ‘funny.’ What condition should I use?”
  • “Give me 10 kid-friendly chatbot responses for keywords: help, joke, math, science, bye.”
  • “My Scratch code checks answer contains 'hi' but it doesn’t work when I type ‘Hi!’ What could I change?”
  • “How can I make my bot ask a follow-up question after telling a joke?”

Parent-friendly safety checklist

Use these guardrails so AI stays helpful:

  • No personal info: Don’t share full name, school, phone, or address.
  • Keep it age-appropriate: Ask for “kid-friendly” jokes and replies.
  • Verify in Scratch: AI can suggest ideas, but your child should test each one.
  • Explain the code: After AI suggests something, ask your child: “What does this block do?”

Debugging guide (the most common chatbot problems)

If your child says “It doesn’t work,” try these quick checks:

  • Case sensitivity & punctuation: Hi! might not match hi the way they expect.
    • Fix: check for shorter keywords like “hi” and “hello,” not full sentences.
  • Order matters: If “hi” is checked after a fallback, it never triggers.
    • Fix: put the most common checks near the top.
  • Contains vs equals: contains is usually better for kids.
    • Example: “tell me a joke” should still match “joke.”
  • Nested if/else confusion: It’s easy to misplace blocks.
    • Fix: collapse blocks and re-open them slowly; test after each new rule.

These troubleshooting habits are exactly what build confident coders—especially for coding projects for kids 9-12.

Next Steps: make it a real “project” your child can share

Once the chatbot works, help your child polish it into something they’re proud to show.

Easy upgrades (15–30 minutes)

  • Add 5 more topics: sports, books, games, pets, school.
  • Add sound effects when the bot speaks.
  • Add costumes so the bot changes expression (happy, thinking, surprised).
  • Add a typing animation:
    • Before responding, say "..." for 0.5 seconds to feel more realistic.

Challenge upgrades (30–60 minutes)

  • Conversation memory: store the last topic in a variable called topic.
  • Quiz mode: if the user types “quiz,” ask a math question and check the answer.
  • Multiple jokes: pick a random joke from a list using pick random.

How to get started today (simple plan)

  1. Open Scratch and build the basic chatbot (name + 5 keyword replies).
  2. Test like a detective: try weird inputs like “HELLO!!!” and “tell me a joke please.”
  3. Use AI as a helper to brainstorm 10 more keywords and responses.
  4. Add one upgrade (sound, costumes, or quiz mode).
  5. Share the project with a family member and ask them to “break it” (great testing!).

If you want a steady path for your child beyond this one-off build, keep a “project ladder”: chatbot → quiz game → choose-your-own-adventure story → simple AI-style recommender. That progression turns playful Scratch experiments into real coding confidence.

Key Takeaways

  • A Scratch chatbot teaches core coding skills—inputs, variables, conditionals, and debugging—in a fun, creative format.
  • Keyword-based ‘contains’ checks make a simple bot feel smart, even for beginners ages 9–12.
  • AI help works best as a coach: brainstorm responses, explain logic, and troubleshoot—then test everything in Scratch.
Toshendra Sharma

Auther

Toshendra Sharma