TransWikia.com

Keycard Minecraft system

Arqade Asked on May 8, 2021

Is there a way with command blocks (in minecraft) to scan a player for a name tag named “Keycard” and if they have it open the door and if not it does nothing?

One Answer

you could create a scoreboard objective that checks if a person has the key card and the command would go like this. First, in an impulse command block /scoreboard objectives add KeyCard dummy activate it and it will add a scoreboard objective called keycard. Now put this command in a repeating always active command block. Put in this command in the command block /testfor @a[score_KeyCard_min=1,r=3]

then add a comparator and repeator to look like this it will normally be off unless a player is within a 3 block radius with a score of one keycard.enter image description here

now add two impulse commands one command will have this command init

/scoreboard players add @p KeyCard 1 this will add 1 keycard to the nearest player

and in the next command

/scoreboard players remove @p KeyCard 1

just in case if you want to take the keycard away.

the testfor command (the one in the picture) will create a Redstone current if you have a Keycard score of 1 and are within a 3 block radius which you could hook up to an iron door.

Good luck

CreepedOutNizo,

Answered by Creepedoutnizo on May 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP