Q: Child check in Database firebase not working correctly - Java Everything seems to be correct, but it does not work correctly. It says that the alias is busy even when it is not busy. It checks "players", it doesn't get to the name in it.

DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference("players/" + playerName);
rootRef.addListenerForSingleValueEvent(new ValueEventListener() {

    @Override
    public void onDataChange(DataSnapshot snapshot) {
        if (snapshot.exists()) {
            Name.setError("This alias is already taken");
        } else {

        }
    }

    @Override
    public void onCancelled(DatabaseError error) {
        
    }

});

