I managed to fix it. In case this happens to anyone else, ill say how i did it:
While the mac is booting, right after the sound it makes when you turn it on, press and hold alt. A thingy will appear giving you the option to boot from cd or hard drive. Select but do not boot the cd and press the...