Automatic activation of passive mode in certain areas

Hi, I’m making a zombie server but I encountered a problem that is insurmountable with my skills. My server has certain safe zones, and I wanted every player who enters a safe zone to get the passive mode enabled and when leaving the safe zone it would be disabled. But I don’t know how to do this. So I came here to ask for help. Thank you!

This should work