Ok, so I am new to scripting, and i am trying to make a custom playerlist and i’ve run into a wall with it as of now. Im trying to find out how to check if a player is following another player. I checked the article about social SetCores and GetCores within this article New SetCore Methods for prompting social actions .
Basically, i just want someone to tell me what function it is to check if a player is following another player if there is any. Any help would be appreciated!
I assume you mean followers on the website. There are some previous posts about this.
http://api.roblox.com/docs#Friends
This one seems to have a tutorial:
At the moment, in-engine social APIs do not have any kind of support whatsoever for followers. You will have to, as the above thread outlined, use either web endpoints or a proxy for API requests that facilitates this (e.g. rprxy.xyz - you make a call to the Roblox API but replace roblox.com
with rprxy.xyz).
Alright thank you for the help!
How would that code actually look like?
There’s actually a property that does this for you. Should look something like this when used:
-- In a localscript
local Player = game.Players.LocalPlayer
game.Players.PlayerAdded:Connect(function(otherPlayer)
if otherPlayer.FollowUserId == Player.UserId then
-- OtherPlayer followed Player
end
end)
While @PostApproval 's method does work, I’m not too keen on sending HTTP GET requests to proxy servers when the functionality is provided for you.
FollowUserId is used to determine if a player followed another player into a game from the website. It’s not what OP is looking for, which is to determine if the social relationship between two players is following. Roblox does not support this natively through any engine API, an HTTP request is required.
To better understand it (either for yourself or for others who are looking at this response): here is the profile for a friend of mine who is currently playing a game.
If I join that game normally through the game page, I did not follow this user, therefore FollowUserId will be 0. However, if I click that door icon (follow), then I’ve followed this user into the game. FollowUserId will then be set to that player’s UserId.
This is all explained right on the page of FollowUserId.
Most people follow others through the follow button on the website. If another player joins another game simply because they’re friends and Roblox deems it so, it should be treated as unintentional.
It would be weird otherwise.
I don’t exactly understand this response. Mind elaborating? Sorry.
For clarification, there are two types of following: following into game and following profile. There are no APIs that allow developers to see or interact with which users someone is following. FollowUserId is for the follow into game feature.
If a user is following the player through their profile, it should be seen as intentional. If the user has a follower who happened to join the game, it should be seen as unintentional.
I do believe this is the behaviour already (I’d have to test first, would rather not say something I currently don’t know for a fact), but now I’m lost as to the relevance it has to the topic. Point I’m making is that FollowUserId is not applicable in this situation as it’s only used to determine if one player followed another into a game rather than to see the social status between two users.
My mistake. This whole time, I thought that we were talking about if a player followed another user in game and not the social status (which are clearly different). I guess if someone magically wants to know how to see if the Player1 followed Player2 in game, they could look at the code I posted.
Otherwise, it’s been nice exchange of messages. Have a great rest of your day!