Detecting if a player is joining from an invite or joining a friend?

I’ve been making a building game and I want to detect if a player is joining from an invite or if they’re joining a friend, so that it automatically teleports them.

How do I do this?

I’m not sure if you can detect invite joins, but you can detect joining a player.

This can be done by getting the JoinData of a player using Player:GetJoinData(). The property for your request is the ReferredByPlayerId but I suggest checking the document yourself to customize it depending on your needs.

To detect if they are friends use FollowUserId to get the followed players user id (or check if it’s 0), get them through :GetPlayerByUserId() and use the IsFriendsWith method to detect if they are friends.