rename does not distinguish between files and folders.
The shell is responsible for expanding the wildcard * into files and folders.
* will be expanded to all non-hidden files and folders.
*/ will be expanded to all non-hidden folders.
But I don't know of any way to expand to files only. You can use find -exec instead.
only folders:
rename 's/ /\n/g' */
or
find . -maxdepth 1 -type d -exec rename 's/ /\n/g' {} +
Only files:
find . -maxdepth 1 -type f -exec rename 's/ /\n/g' {} +
Note that find will also find hidden files unlike * (unless you turn on the dotglob shell option by running shopt -s dotglob).
zsh seems to be able to match files only with wildcards.
Disclaimer: I would not recommend adding newlines to file names as it may cause trouble and break many scripts.