How to Make a Minecraft Turtle Move With Code (CC:Tweaked Lua for Beginners)
If you've installed CC:Tweaked in Minecraft, you already have a programmable robot sitting in your inventory.
It just needs a program.
In Episode 2 of our Minecraft Turtle series, we write the simplest kind of Lua code — the kind that tells a Turtle to walk one way, turn, and walk another. Two directions. Six lines. Your first real Lua program.
Watch it in under a minute:
What Is CC:Tweaked?
CC:Tweaked is a free Minecraft mod available on CurseForge and Modrinth. It adds Computer Blocks and Turtle robots that you can program using Lua — a real programming language used in actual game engines.
You are not using a watered-down kids' version of code. You are writing Lua.
What Is a Turtle?
A Turtle is a robot you craft in Minecraft. Right-click it to open a terminal, and you can type programs directly — or write a program file and run it. That is what we are doing today.
You do not need any coding experience to follow along. If you have played Minecraft, you already know enough to get started.
Your First Program: Walk, Turn, Walk
Open the Turtle terminal and type edit move to create a new program called move.
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
Press Ctrl, choose Save, then Exit.
Now type move in the terminal and press Enter. Watch the Turtle go.
What Each Line Does
| Command | What It Does |
|---|---|
turtle.forward() |
Move one block forward |
turtle.back() |
Move one block backward |
turtle.turnRight() |
Turn 90 degrees to the right |
turtle.turnLeft() |
Turn 90 degrees to the left |
These are functions — named actions built into CC:Tweaked. You call them by writing the name followed by (). Every line is one instruction. The Turtle runs them top to bottom, one at a time.
Why This Matters (Even If You Are New to Code)
This tiny program teaches three ideas that show up in every program you will ever write:
- Sequence — code runs in order, line by line, no skipping
- Functions — you call a named action to make something happen
- Cause and effect — your program produces a real, visible result
The Turtle moving is not magic. It is your code, running exactly as you wrote it.
The One Mistake Beginners Make
Forgetting the brackets.
turtle.forward does nothing. turtle.forward() runs the action. The () is how you tell Lua "do this now." Leave them out and nothing happens — and Lua will not warn you.
What Is Next
Episode 3 builds on this: instead of writing turtle.forward() six times, we use a loop to walk any distance we choose. One loop. No repeated lines. Same result, smarter code.
Full code on GitHub: turtle-forward
Watch Episode 2 on YouTube: Minecraft Turtle ep2 — Move Forward and Turn
Cognito Coding — Learning To Code By Solving Real Problems.