i cant think of anything of how to do this and dont know where to look for the
game.Players.PlayerRemoving:Connect(function(player)
local friends = player:IsFriendsWith(game.Players.LocalPlayer.UserId)
if friends then
friendCount -= 1
NumberOfFriendsInGame.Text = "Friends: "..friendCount
end
end)
This error occurs because :IsFriendWith doesn’t work on a player that isn’t in-game anymore. Instead, you could try and do it vice-versa by getting checking if you are friends with the person who left.
game.Players.PlayerRemoving:Connect(function(player)
local friends = game.Players.LocalPlayer:IsFriendsWith(player.UserId)
if friends then
... do the rest here
end
end)