PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

IsFriendsWith

The IsFriendsWith Player function sends a request to the Roblox website asking whether a player is a friend of another user, given the ID of that user.

##Note
Using this in a Script, as opposed to a LocalScript, will not get you the most up-to-date information. If a player leaves a group while they are in the game, IsIFriendsWith will still think they’re in that group until they leave. However, this does not happen when used with a LocalScript.

This is because the method caches results, so multiple calls of IsFriendsWith on the same player with the same user ID will yield the same result as when the method was first called with the given user ID.

##Tutorials Used In

Parameters

Name Type Default Description

The userId of the specified player.

Returns

Return Type Summary

A boolean indicating whether a player is a friend of the specified user.


Code Samples


How to Check if a Player is a Friend

The below example would print whether or not a recently added player is friends with Gordonrox24.

game.Players.PlayerAdded:Connect(function(player)
	if player:IsFriendsWith(146569) then
		print(player.Name .. " is friends with gordonrox24!")
	end
end)