several possible reasons:
MIDI-cable could be broken.
They are pretty delicate and stepping on ao bending can harm them.
You can try a different cable if you have one
*Latency-settings. *
Look at Settings on the Audio-tab
What do you have
512/ 11
Quantification setting in piano-roll
The Q-value will place your notes when you capture notes with either a MIDI-KB or a PC-KB. For live-capture you should always set Q >= 1/48
to capture exactly what you do play at the positions the key is pressed, use 1/192