Solved While right click

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

Jay_2004

Member
Feb 21, 2017
13
1
3
25
Is there a way to make it so that when you right click, it triggers a "while" event that keeps going while you are right clicking.

Code:
on right click with 2256:
    if {alreadyfiring.%player%} is not set:
        if player is right clicking:
            set {alreadyfiring.%player%} to "True"
            while player is right clicking:
                wait 2 ticks
                make player shoot snowball at speed 3
                play raw sound "tile.piston.in" at location of player with pitch 2 volume 1
            delete {alreadyfiring.%player%}
        else:
            stop
Obviously, the "if player is right clicking" and "while player is right clicking" don't work, thats what I need help with.
If anyone could help or have another idea I could do this a reply would be great :emoji_slight_smile:
 
Im confused here too.
On right click... while right clicking? What is the point of that.
Your effect while fire each time a player right clicks.... no need to use a condition to check for right clicking and use a while loop.
 
doesn't work. Its way too slow to meet the ROF of an AK...
on right click with (gun):
while player is holding right click:
wait 1 tick
make player shoot snowball at speed 3
 
code_language.skript:
On right click:
 If {holdclick::%uuid of player%} is not set:
  Set {holdclick::%uuid of player%} to 0
  While {holdclick::%uuid of  player%} < 5:
   make player shoot snowball at speed 3
   Wait 1 tick
   Add 1 to {holdclick::%uuid of player%}
   If {holdclick::%uuid of player%} is not set:
    Stop
  Delete {holdclick::%uuid of player%}
 Else:
  Set {holdclick::%uuid of player%} to 0

On script load:
 Delete {holdclick::*}
[doublepost=1545246143,1545228756][/doublepost]
code_language.skript:
On right click:
 If {holdclick::%uuid of player%} is not set:
  Set {holdclick::%uuid of player%} to 0
  While {holdclick::%uuid of  player%} < 5:
   make player shoot snowball at speed 3
   Wait 1 tick
   Add 1 to {holdclick::%uuid of player%}
   If {holdclick::%uuid of player%} is not set:
    Stop
  Delete {holdclick::%uuid of player%}
 Else:
  Set {holdclick::%uuid of player%} to 0

On script load:
 Delete {holdclick::*}
I have found another way to do this without using variables. Hope this helps!

code_language.skript:
on right click:
    loop 4 times:
        shoot snowball at speed 3
        wait 1 tick
 
  • Like
Reactions: XanderWander
code_language.skript:
On right click:
 If {holdclick::%uuid of player%} is not set:
  Set {holdclick::%uuid of player%} to 0
  While {holdclick::%uuid of  player%} < 5:
   make player shoot snowball at speed 3
   Wait 1 tick
   Add 1 to {holdclick::%uuid of player%}
   If {holdclick::%uuid of player%} is not set:
    Stop
  Delete {holdclick::%uuid of player%}
 Else:
  Set {holdclick::%uuid of player%} to 0

On script load:
 Delete {holdclick::*}
[doublepost=1545246143,1545228756][/doublepost]
I have found another way to do this without using variables. Hope this helps!

code_language.skript:
on right click:
    loop 4 times:
        shoot snowball at speed 3
        wait 1 tick
Thanks! :emoji_slight_smile:

Finished Product:
 
Last edited:
  • Like
Reactions: XanderWander
Status
Not open for further replies.