In a script, most definitely. In a UI? depends who sees the UI, ROBLOX likes to regulate such things based on who can see it (TextLabel, etc.), if it’s a developer popup that only shows for the developer of a game / owner of the group I reckon it’d be fine. I think it’s FilterStringAsync rules.
Conclusion; if it’s a restricted display that doesn’t show for everyone, should be fine, else probably not.
You are not allowed to display a Discord invite link to users per the Community Standards (see the “Directing Users Off-Platform” portion of the “Security” section). I would hazard a guess that moderation would reasonably expand this to invite links within scripts.
You can include Discord webhook links within code to perform HTTP requests to as you would any other URL, but as far as I know, Discord has blocked traffic from ROBLOX servers, so you’d have to route it through a proxy anyway.
Adding onto this, you can display social media links like Discord within your Roblox games, so long as you gate it by if the user is eligible with PolicyService.