When you use environment variables that were set inside a FOR loop, you typically need to use the "setlocal enabledelayedexpansion" and then access them with ! instead of %. Here is your script with those 2 changes:
@echo off
setlocal enabledelayedexpansion
title Folder Maker
color 0a
cls
set /p folder=How many folders would you like to make:
for /l %%a in (1,1,%folder%) do (
cls
set /p foldername=What would you like to name folder #%%a:
mkdir "!foldername!"
set foldername=
)
msg * All folders created!