There are guides that can help you make a door open when you insert green keycards or stuff like that, but the problem is, you don’t get the keycard back…If you use a item granter to give it back, for whatever reason, it doesn’t work. Same with using vending machines that grant the item back. So, here’s how to make a door that only allows you to open it if you have a certain item in your inventory…Works best with doors that close after an amount of time…
Items Needed:
Property x1
Button x1
Trigger x1
Inventory Item Manager x1
Barrier x1
Wire Repeater x1
So this is what you have to do…
-
Decide what you are going to use as the item you need to open the door. I used golden keycards.
-
Name your property. I named my property GoldenKeycard. Set the scope to player, and the type to number. This will be crucial for the code later on.
-
Place your inventory item manager down. Set it to track golden keycards. Also go to properties and have it update the property GoldenKeycard.
-
Place down your trigger. Wire the property to the trigger. When property value changes-------trigger. Set the trigger to invisible and untriggerable by player collision. Copy down the following code.
-
Place down your button. Set it to deactivate on game start, and scope to player. After, make it activate when receiving on OpenGoldDoor, and deactivate it when receiving on CloseGoldDoor.
That is all you need to make a button that can be pressed if you have an item! Now if you want to make the door, do the following steps. -
Place down your barrier. Configure it to whatever you like. Next, wire the button to the barrier. On button press--------deactivate barrier.
-
Place down your wire repeater. Configure the settings, and set the delay to a number. This number will be how long your door stays open before you have to open it again. I find 3 seconds to be optimal.
-
Wire the wire repeater to the barrier. On wire pulse------activate barrier.
There! You should now have a door that only allows you to open it when you have a gold keycard! Please let me know if this guide is flawed, tips and constructive criticism are very much welcomed, as well as liking and subscribing (yes, I know, subscribing doesn’t exist, go with it), and yeah-Please give feedback, see if it works, whatnot, yada yada yada. Have a good day! (Or night)