When i use an external keyboard all the keys work good
With you replacing the internal keyboard and it still happening and a known good external not doing it, you are looking at two things:
1. The connector on the motherboard is bad (which usually isn't the case)
2. The keyboard you just bought (internal) is DOA or not seated good.
Double-check your connections and make sure that everything is good and snug and didn't come loose by accident.
Was anything spilled on the keyboard before replacing it?
What keys in particular are not working properly?