Use Particles2D, attach it to your player, and write a script using
$(what you named the particles2D).emitting = true for when you are pressing left and right, and
$(name).emitting = false when you are not. Look up a tutorial on particles2D to adjust how they look and work, and you should end up with something similar.
also make sure to turn off local cords