While 2FA won't stop an in-game script from stealing pets, it protects your Roblox account from being fully taken over.
Only trust updates and news from the official BIG Games social media accounts. Pet Simulator X Bank/Mail Stealer
If you look at the script and it’s a giant wall of unreadable gibberish (hexadecimal or base64), it is likely hiding a "SendMail" or "BankInvite" command. While 2FA won't stop an in-game script from