I found an error when the client leaves the game.
The error emits because of variable following_body, which contained a player, who left. It’s easy to fix, before changing the key’s global position, we just need to check if following_body exists (is_instance_valid = returns true if player not freed)
class_name Key
extends Node2D # key.gd
var following_body: Player
func _process(delta: float) -> void:
if is_instance_valid(following_body):
global_position = lerp(
following_body.global_position + follow_offset,
global_position,
pow(0.5, lerp_speed * delta)
)