Jack shaft problem on a Baja heat65 mini bike please help

I have a Baja ht65 mini bike model 2007 that I was given from a neighbor, stuff was wrong with it but we fixed it and it worked, then we put it away for the winter, then next summer I get it out to test it and after fiddleing with the carborator and tank it seemed to work, it turned on but as I got on and throttled it, it started moving then stopped and I could hear a rattling sound from the jack shaft, so I take off the cover and the sprocket connected to the first chain was off. I looked around And saw the little key thing (rectangular key you stick in the hole on the jackshaft in the sprocket) was laying on the rod of the jackshaft or whatever it’s called. So I put the sprocket back on and inserted the key and turned it on again and it fell off again, so I messed with it and couldn’t get it to work I finally gave up and put it back then this summer (2021) I tried again and got nuts I thought I could fit onto the threaded part but nothing worked. I did more research and found out what the bike was and found all the parts and stuff I would need but I don’t know if I should order them or if I’m doing something wrong, can someone help me