How do you get a security key for SpongeBob life?

When you save a person, you get a key. If you did not get the key, there is a door at the end of the level that takes you to where a person is trapped. Use the karate chop or butt bounce to destroy the jail cell, rescue the person, and get the key