Um, I would suggest the following:
touch_end(integer total_number) { if (llSameGroup(llDetectedKey(0)){ state closed; //or state open, depending where we are } else{ llRegionSayTo(llDetectedKey(0),0,"Sorry, but you do not have the right group tag active to use this door"); } }