a .3kg mass moving on a horizontal, smooth incline has a speed of 5m/s and hits a spring with spring constant 3.0N/m. What is the maximum amount that the spring is compressed?

I did Ei=PE + KE = Ef= PE
=1/2mv(i)^2 + mgH = 1/2 k (y2-y1)

=(1/2)(.3)^2 + (.3)(9.8)H=(1/2)3(y2-y1)

what is H? is this set up correct?

Let us assume that 5 m/s is the speed when it hits the spring. A "horizontal incline" is sort of a contradiction (oxymoron). The height term H and gravity do play a role in this problem.

The spring will compress an amount X such that
spring PE = initial KE
(1/2) k X^2 = (1/2) M V^2,
at which point the mass will turn aound and the pring will expand.
X^2 = (M/k) V^2
X = V sqrt(M/k)