It could be a simple "reset" is needed, or it may need a new motor (hopefully it's the former).
Try this to rest it:
If the sunroof does not close or open automatically, use the following procedure to return sunroof operation to normal.
- Close the sunroof if it is not in the closed position. It may be necessary to repeatedly push the switch to close the sunroof.
- Press and hold the TILT UP switch. Do not release the switch, keep pressure on it. After 10 seconds of depressing, the sunroof will tilt up, then tilt down. Release the button.
- Press and hold the TILT UP switch again. Do not release the switch, keep pressure on it. While depressing the switch, the sunroof will “Slide open” “Slide close” “Tilt up” “Tilt down”. Release the button after the sunroof “Tilts down” and stops.
- Initializing procedure is complete. Confirm proper operation of the sunroof (slide open, slide close, tilt up, tilt down.)