Your question is a variation of the question, "if there is no self, then who is responsible for actions?"
The Buddha rubbished the notion that there is no self doing anything, in the Attakari Sutta:
“Venerable Gotama, I am one of such a doctrine, of such a view: ‘There
is no self-doer, there is no other-doer.’”
(“Natthi attakāro, natthi parakāro.”)
“I have not, brahman, seen or heard such a doctrine, such a view. How,
indeed, could one — moving forward by himself, moving back by himself
— say: ‘There is no self-doer, there is no other-doer’? What do you
think, brahmin, is there an element or principle of initiating or
beginning an action?”
“Just so, Venerable Sir.”
“When there is an element of initiating, are initiating beings clearly
discerned?”
“Just so, Venerable Sir.”
“So, brahmin, when there is the element of initiating, initiating
beings are clearly discerned; of such beings, this is the self-doer,
this, the other-doer.
“What do you think, brahmin, is there an element of exertion ... is
there an element of effort ... is there an element of steadfastness
... is there an element of persistence ... is there an element of
endeavoring?”
“Just so, Venerable Sir.”
“When there is an element of endeavoring, are endeavoring beings
clearly discerned?”
“Just so, Venerable Sir.”
“So, brahmin, when there is the element of endeavoring, endeavoring
beings are clearly discerned; of such beings, this is the self-doer,
this, the other-doer. I have not, brahmin, seen or heard such a
doctrine, such a view as yours. How, indeed, could one — moving
forward by himself, moving back by himself — say ‘There is no
self-doer, there is no other-doer’?”
There is a self (the self-doer), but this self is not impermanent and is conditioned and compounded. It arises from the inter-working of the five aggregates, and ceases when the five aggregates cease. By breaking down a violin to its constituent components, you cannot find something called music. Similarly, by breaking down the five aggregates, you cannot find anything called the self. The self, like music, depends on the inter-working of other components, that are themselves dependent on other things. The self, like music, is not non-existent. Please see this answer for more details.
There is such a thing as the concept of wholesome thinking in Buddhism. Being virtuous, one reaps material benefits (see Ittha Sutta) and is also lead towards enlightenment (see Kimattha Sutta).
So, how can a lay person cultivate a wholesome way of thinking that would lead him towards becoming virtuous? AN5.57 holds the answer:
“And for the sake of what benefit should a woman or a man, a
householder or one gone forth, often reflect thus: ‘I am the owner of
my kamma, the heir of my kamma; I have kamma as my origin, kamma as my
relative, kamma as my resort; I will be the heir of whatever kamma,
good or bad, that I do’? People engage in misconduct by body, speech,
and mind. But when one often reflects upon this theme, such misconduct
is either completely abandoned or diminished. It is for the sake of
this benefit that a woman or a man, a householder or one gone forth,
should often reflect thus: ‘I am the owner of my kamma, the heir of my
kamma; I have kamma as my origin, kamma as my relative, kamma as my
resort; I will be the heir of whatever kamma, good or bad, that I do.’
And what about a noble disciple?
“This noble disciple reflects thus: ‘I am not the only one who is the
owner of one’s kamma, the heir of one’s kamma; who has kamma as one’s
origin, kamma as one’s relative, kamma as one’s resort; who will be
the heir of whatever kamma, good or bad, that one does. All beings
that come and go, that pass away and undergo rebirth, are owners of
their kamma, heirs of their kamma; all have kamma as their origin,
kamma as their relative, kamma as their resort; all will be heirs of
whatever kamma, good or bad, that they do.’ As he often reflects on
this theme, the path is generated. He pursues this path, develops it,
and cultivates it. As he does so, the fetters are entirely abandoned
and the underlying tendencies are uprooted.
By reflecting on the notion that all beings are owners of their kamma (and inherit the results), the noble disciple cultivates a wholesome thinking that results in renunciation.