I wrote these scripts a while ago they may help with your problem.
The link to the thread is here too.
https://forum.game-guru.com/thread/213190?page=2
Here are scripts that will allow the player to NOT collect keys, or if the script is edited, other entities to be collected through walls.
Unzip the _lua_zone folder into your scriptbank folder, and the map into your mapbank folder.
On the testmap if you run around the outside of the walls, you cant get the keys that are on the tables inside next to the walls, with the pickup key script original you could pick up through walls. The trick is to setup a zone INSIDE your room or building and if the player enters it set a variable which the key_get_zone.lua checks to see if it is 1, if so then allows pick up of key, if 0 (Outside of zone) then no pick up.
plrinzone_collector.lua assign to zone.
key_get_zone.lua assign to you key or object. Dynamic.
Simple but very useful. Well I hope so anyway.
UPDATE
_________
Just discovered that the key collection only script only work on 1 zone, if you add same script to another zone it messes up.
Below are the newer versions, as before:
plrinzone_collector.lua assign to zone.
key_get_zone.lua assign to you key or object. Dynamic.
The scripts number are important plrinzone0 and key_get_zone0 must be the same area, and so on up to the 15 i've made for you. If you need more just go into the scripts change the init, main and any instances of the variable insidez to the same number: eg:
if the key_get16_zone_init(e)
then the variable should be changed insidez16
same goes for the other script, hope thats all clear...... all working good here now
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.