Click 50 times for open iron door

  • 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!

AlliSighs

New Member
Feb 12, 2024
8
0
1
14
Hi all. I have a problem. I'm creating a plot script for "breaking down" iron doors. The player needs to click iron door 50 times with the LMB to open it. However, it opens for me the first time. Help me please.

My code:

on left click on iron door:
set {click_count} to {click_count} + 1
if {click_count} is greater than or equal to 50:
activate block
wait 2 seconds
deactivate block
 
Hi all. I have a problem. I'm creating a plot script for "breaking down" iron doors. The player needs to click iron door 50 times with the LMB to open it. However, it opens for me the first time. Help me please.

My code:

on left click on iron door:
set {click_count} to {click_count} + 1
if {click_count} is greater than or equal to 50:
activate block
wait 2 seconds
deactivate block
I figured out a solution and a few fixes to your current code. See the spoiler below for the code (With notes for stuff I added/changed):
Code:
on left click on iron door:
   add 1 to {click_count.%player%} # We can just manually add 1 to the variable. Also attach it to the player so it's not 50 combined clicks from multiple players
   if {click_count.%player%} is 50: # We change this to is 50, that way if a player clicks it more times it no longer activates the block
      activate block
      wait 2 seconds
      deactivate block
      clear {click_count.%player%} # We clear the variable after the two second delay, that way after it closes, the previous code can be reused.
 
  • Like
Reactions: AlliSighs
I figured out a solution and a few fixes to your current code. See the spoiler below for the code (With notes for stuff I added/changed):
Code:
on left click on iron door:
   add 1 to {click_count.%player%} # We can just manually add 1 to the variable. Also attach it to the player so it's not 50 combined clicks from multiple players
   if {click_count.%player%} is 50: # We change this to is 50, that way if a player clicks it more times it no longer activates the block
      activate block
      wait 2 seconds
      deactivate block
      clear {click_count.%player%} # We clear the variable after the two second delay, that way after it closes, the previous code can be reused.
Good! However, there is a bug. When the door is open and the player clicks on it, the messages (which I added when clicked) are not blocked. How to block them when the door is open?

on left click on iron door:
add 1 to {click_count.%player%}
send "Hit the door another %{click count.%player%}% time to knock it down!" to player
if {click_count.%player%} is 50:
activate block
wait 12 seconds
deactivate block
clear {click_count.%player%}
 
Last edited:
Were you trying to do this:

code_language.skript:
on left click on iron door:
    add 1 to {doorclicks::%player%}
    if {doorclicks::%player%} >= 50:
        activate event-block
        delete {doorclicks::%player%}
        wait 12 seconds
        deactivate event-block
    else:
        send "&fHit %50 - {doorclicks::%player%}% more times to break the door down!" to player