Open iron door with a key

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

iStopcontact

Member
Feb 18, 2017
113
2
18
23
Hey guys,

I am working on a reallife server with in my skript i want to have keys for iron doors.

That's not that hard but now i want to have just keys for diffrent doors.

So for example a key for house1, and a key for house2 but they cant open each other.


This is what i have in my skript:
code_language.skript:
on right click on iron door:
    if tool of player is name tag:
        if name of tool of player is "House1":
            if name of targeted block is "House1Door":
                activate block
                wait 2 seconds
                deactivate block
        else:
            message "You don't have a key!"

The part with "if name of targeted block is "House1Door" gives no errors but it isnt working.
So can someone maybe help me with this?
 
you can't save the name of a block once it's placed, but you can save it's location in a variable on place and check that against the target block.
 
ye, though you'd only need to do it once. Once you have the variables assigned you could get rid of the code that does the assigning.
 
Yhea but then i need to change the code every time i place a door haha
True, but it'd be like a setup sort of thing you'd only have to do once. Better yet, you could add the locations to one list variable and just compare the target block location with the list. Just less variables to mess with there.

That's the only way I can think of, like I said placed blocks don't hold names.
 
Status
Not open for further replies.