are you using smbx2? goal npcs are very clearly indicated, being within the "exits" or "progression" category. placing one down will allow the player to collect it and end the level.
the list of npcs which trigger a level exit is:
- smb2 crystal ball (npc-41)
- smb3 card roulette (npc-11)
- smb3 power star (npc-97)
- smb3 ?-sphere (npc-16)
- smw goal tape (npc-197)
- smw switch palace switches (npc-440 to npc-443)
other ways to allow a level to be exited exist too such as warps, offscreen exits or smw keyholes.