Let $G$ be a finite group, and $p$ be a prime. Then there is a generalized character $\Psi$ of $G$ which takes value $0$ on all elements of order divisible by $p$, and has $\Psi(y)$ equal to the number of elements of $C_{G}(y)$ of order a power of $p$ whenever $y$ has order prime to $p$. The fact that $\Psi$ is a generalized character is a consequence of Brauer's characterization of characters, and Frobenius's theorem that for any finite group $X$, the number of elements of $X$ of order a power of $p$ is an integer multiple of the order of a Sylow $p$-subgroup of $X$.
So far, I have not encountered an example where $\Psi$ is not a character, but I know no proof that $\Psi$ is always a character, even for solvable groups. So I ask here if $\Psi$ is always a character. In fact, $\Psi$ is a difference of characters afforded by projective $RG$-module for $R$ a suitable complete dvr with residue field of characteristic $p$, so one might more ambitiously ask if $\Psi$ is a non-negative integer combination of characters of projective indecomposable $RG$-modules. (Note: This more ambitious version has a positive answer in the case that $G$ has a normal $p$-complement).
There are several motivations for studying the class function $\Psi$ : if $G$ is a finite simple group of Lie type in characteristic $p$, then $\Psi$ is the square of the Steinberg character of $G$, so is certainly the character of a projective $RG$-module, so perhaps, in general, this $\Psi$ might play a similar role for general finite groups.
The generalized character $\Psi$ is also somewhat related to a construction used by J.A. Green in his famous paper on the characters of ${\rm GL}(n,q).$
For a general finite group $G$ and a (characteristic $p$) Brauer character $\phi$ of $G$, we may extend $\phi$ to a generalized character $\phi^{\ast}$ of $G$ by setting $\phi^{\ast}(xy) = \phi(y)$ whenever $x,y$ are elements of $G$ with $xy = yx$ and $y$ has order prime to $p$, while $x$ has order a power of $p$.
It is relatively easy to check that $\Psi$ is a non-negative integer combination of characters of projective indecomposable modules if and only if we have $\langle \phi^{\ast},1 \rangle \geq 0$ whenever $\phi$ is an absolutely irreducible (characteristic $p$) Brauer character of $G$.
Likewise, $\Psi$ is a character of $G$ if and only if we have $\langle \chi_{0}^{\ast}, 1 \rangle \geq 0$ whenever $\chi$ is an ordinary irreducible complex character of $G$, and $\chi_{0}$ is the Brauer character obtained by restricting $\chi$ to elements of order prime to $p$.
Later addendum: I should perhaps have pointed out that when $G$ has order prime to $p$, $\Psi$ is just the trivial character, while if $G$ is a $p$-group, $\Psi$ is the regular character. In fact, it is always the case that when $\Psi$ is expressed as a $\mathbb{Z}$-linear combination of characters of projective indecomposable $RG$-modules, the character of projective cover of the trivial module occurs with coefficient $1$.
Later edit: Since time is expiring, and partly because of comments by Will Sawin and Tom Wilde, let me mention some general observations. It is not true in general that (for a divisor $n$ of $|G|$), if we define the class function $\theta_{n}$ of $G$ via $\theta_{n}(g) = $ (the number of $n$-th roots of $g$ in $G$), then $\theta_{n}$ is a character of $G$ (it is a generalized character by a theorem of Frobenius, or by considering Adams operations). The Frobenius-Schur indicator shows this (in general) for $n = 2$, since $\theta_{2} = \sum_{ \chi \in {\rm Irr}(G)} \nu(\chi) \chi,$ where $\nu(\chi)$ is the Frobenius-Schur indicator, so for any group containing an irreducible character with FS-indicator $-1$, $\theta_{2}$ is not a character.
However, there is some computational evidence that $\theta_{n}$ IS a character in the case that ${\rm gcd}(n, \frac{|G|}{n}) = 1,$ but for $n$ not a power of $p$, I would at present have no idea whatsoever how to prove this (apart possibly from the case of solvable groups). The question here is the case $n = |P|$ for $P$ a Sylow $p$-subgroup of $G$, where more computations have been done.
The best theoretical evidence I have that $\Psi = \theta_{|P|}$ should be a character (in fact, even the character of a projective $RG$-module for $R$ as before) is the following:
If we let $G$ be any group, and we let $s$ run over a set of representatives of the conjugacy classes of elements of order prime to $p$ in $G$, and we define the generalized character $\Psi_{s}$ of $C_{G}(s)$ as we did for $G$ ( so $\Psi_{s}(y)$ is the number of $p$-elements of $C_{G}(s) \cap C_{G}(y)$ if $y \in C_{G}(s)$ has order prime to $p$, and $0$ if $y \in C_{G}(s)$ has order divisible by $p$), then we find that $\sum_{s} {\rm Ind}_{C_{G}(s)}^{G}(\Psi_{s})$ is the character afforded by what I call the "truncated conjugation module". This character takes value $|C_{G}(x)|$ if $x$ has order prime to $p$, and $0$ if $x$ has order divisible by $p$. Orthogonality relations from block theory show that this is the character of a projective $RG$-module (this is the "lift" to $R$ of a naturally defined projective module in characteristic $p$, but I don't know of a "natural" way to describe the lift). Of course this does not of itself prove that the summands are all characters, but it would require some cancellation if the individual summands are just generalized characters, and since the formula holds for every $G$, it at least suggests that the summands should themselves be characters.
Update: I have recently managed to prove that $\Psi$ is a character of $G$ in the case that $C_{G}(x)$ has a normal $p$-complement for each non-identity $p$-element $x$ of $G.$ This proves, for example, that $\Psi = \Psi_{p}$ is a character of $G$ for each prime divisor $p$ of $|G|$ when $G = {\rm PSL}(2,q)$ ($q$ not necessarily a power of the prime $p$). This may be regarded as further "theoretical" evidence that $\Psi$ may always be a character.