This behavior pack uses scoreboards to detect if a player has nothing in their inventory. You can then run your own commands based on the player's score.
Add the Detect Empty Inventory Add-on to your behavior packs on your world. Behavior packs disable achievements, but editing the world with an NBT editor can re-enable achievements when uploading your world to a realm.
Re-enable achievements on either pc or mobile with the free NBT editor Dovetail
You can give players who have nothing in their inventory an effect, like strength. This example command would be put into a repeating command block, set to unconditional, always active in a tickingarea.
effect @a[scores={empty_inventory=1}] strength 1 0 true
_ _ _ _ _
(_) _ _ | | (_) | | |
____ _ _| |_ _| |_ _____ ____ ___| |_____ _____| | |
| \| (_ _|_ _) ___ | _ \ /___)_____ (____ | | |
| | | | | | |_ | |_| ____| | | |___ | | / ___ | | |
|_|_|_|_| \__) \__)_____)_| |_(___/ |_\_____|\_)_)