One way is to create a Gate, and not to let entities when the resource is not sufficient. The other way, which is the better but harder way, is to use MATLAB Discrete-Event System (MDES) block.
MATLAB Discrete-Event System (MDES): https://www.mathworks.com/help/simevents/ref/matlabdiscreteeventsystem.html