Mm....How did it come off? You mean the star on the left? OR the chain on the right?
Once I opened up a Tamagotchi, and the thing on the side is attached to a thing in the inside, there's a thing that you have to buckle it in.
If that snapped off, you can try using Hot Glue. Just a little drop will be fine. Hot glue is better than Super Glue yet also more dangerous. BE careful!
It comes in a tube (about 4 inches / 10 cm long.) It's used to assemble plastic models of ships, airplanes, cars, etc. Check your local hobby shop (the kind that sells model trains and model airplanes), they'll have some.