The fact that only 3000 people were slain indicates there was some criteria used to determine who would live and who would be slain.
We do not hear what that criteria was for those who were slain.
I assume each was questioned about the GoldenCalf and their attitude toward it with respect to the Lord. Those who preferred the GoldenCalf were slain. Those that repented were saved.
When we look to the DayOfPentecost in which the HolySpirit was poured out, we see 3000 people turned to the LordJesusChrist and being saved.
The criteria for being saved is to receive Christ Jesus as MightyGod, Lord and Saviour.
It is worth noting that the unbelieving Jewish leadership persecuted Peter and the other disciples for their faith in Christ Jesus and their testimony of Him.
In the GoldenCalf episode everyone was saved but 3000. On the DayOfPentecost everyone remained lost except the 3000.