The problem:
With Home-Based Businesses from EP18, areas marked as Residential are supposed to stay private.
Customers and employees can still wander into them, though — using computers, opening the fridge, eating food, and generally making themselves at home unless you also lock the doors.
The fix:
If a customer or employee enters a Residential area, they will now be redirected back to the public part of the business.
Members of the lot owner's household are completely unaffected and can use the Residential area normally.
The fix also accounts for zoning changes made in Build Mode while the business is running. If you repaint the zones, Sims will be redirected to the current public area rather than an outdated location.
This script does nothing on regular lots that aren't running a home-based business.