Hi @Prateek Sinha ,
According to the official documentation, embed code that uses script tags is not supported.
Reference:
Add content to your page using the Embed web part
If you want to use custom features on modern pages, I recommend you to use SharePoint Framework.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.