So I recently found my old electrum wallet, problem is I only have the xpub for it, can I do anything to get it back or have I lost the wallet?
What exactly did you find? The xpub? Or the wallet (file)?
If you only have the xpub, you are not able to recover the wallet since it only allows you to derive the public keys and addresses and not the private keys which are needed to access the BTC.
Don't you have a backup of your mnemonic code (the 12 words)? You need to write them down when creating an electrum wallet. You are asked to enter the words again, so at some point you had to note them somewhere.