What template are you putting this button in? Sometimes that make a difference in the code. You could try:
HTML Code:
<if condition="is_member_of($bbuserinfo, 5, 6)">
button code
</if>
You posted this exact same question a couple of days ago and then deleted it after saying you figured it out. I also posted the exact same answer (including the part that says you need to specify what template you are wanting to put the code in).
edit: Also, moved to correct forum as this doesn't belong in the Forum and Server Management.