Need Help with creating a Keycard Scanner

Hello. I am working on a keycard scanner script, and everything works, except I want to make it so if a player has weapon_k5 (level 5 keycard), they can open a Level 5 Door, however someone with a weapon_k4, k3, and so on cannot open a level 5 door. I already setup the sweps for the keycards, and setup a bit of a framework for this, but I’m not sure how to make it work. Note: This is based off a script from scriptfodder, however the developer is inactive so I can’t get help from him.

Here are the files involved (At least the ones that should matter - leave a comment if you need any other files…):

stool to place the scanner(kcs.lua):
weapon_k1 (shared.lua):

And yes, it uses wiremod.

Any and all help is appreciated!


The code is stolen from the scriptfodder script, and this is leaked code.