No documentation on wiki mentions this error, and it’s detrimental to my game, as I want to teleport players that aren’t friends with the “Server owner”
This is the code creating the error here:
if not ServerOwner.Value:IsFriendsWith(Player.UserId) then
The ServerOwner is a ObjectValue containing the first player that joins the server, and all preceding players go through this check to ensure they are friends with the server owner, if they aren’t, they go to their own server. Any clues on how I can get rid of this error? FriendService seems to be a service used internally from Roblox
Solutions tried:
Adding a GetService(‘FriendService’) at the top of my code
This error happens because the Player object you are calling :IsFriendsWith on has left the server. You should instead use Player:IsFriendsWith(ServerOwner.Value.UserId), or preferably just store the UserId of the first player who joined the server instead of their player object.
Thanks! I would assume that a player that has left the game, with a reference from the ObjectValue, would still be able to have this function called on it, perhaps a wiki clarification?
Solved the problem, nethertheless!
edit: seems wiki is broken for that page anyway,
“If a player leaves a group while they are in the game, it will still think they’re in that group until they leave. However, this does not happen when used with a LocalScript.”
Doesn’t seem related to checking if someone is friends with someone.