Need help with a lock and unlock system ( group ranked ) for a school group

How would I make an F to unlock doors and Lock doors by group ranks, for example I am making a school which is going to lock and unlock doors for classes. Once the door is unlocked it would stay unlocked until its locked once again. Any suggestions on what to do?

GetRankInGroup, Proximity Prompts (maybe?) and whatever else you want. Check player’s rank, if it’s sufficient then lock or unlock the door based on its current state. Proximity prompts are a convenient way to facilitate this but you can do it in any way you like (see UserInputService).

Up to you what locking and unlocking means. I assume it might just be a simple flick of CanCollide but that part’s also on you to decide how to do it.