help with variables

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

    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!

Diamendd

New Member
Jul 29, 2024
6
0
1
in my skript i have it so whenever you break a certain block it increases a variable and sends a different action bar message until it gets to 3, then it goes back to 1 but i get stuck at 3 and i can't figure out why, can someone please explain why it isint working?

on break of chiseled nether bricks:
if {var} is equal to 1:
send action bar "test1" to player
set {var} to 2
if {var} is equal to 2:
send action bar "test2" to player
set {var} to 3
if {var} is equal to 3:
send action bar "test3" to player
set {var} to 1
else:
send action bar "test1" to player
set {var} to 2
 
The problem you had with the variable was because you didn’t define an end, so it went through every if. When the if condition above the else doesn't work, it always ends up using the else at the bottom.

I revised your code, and it should work now. I hope I could help! ^^

JavaScript:
on break of chiseled nether bricks:
    if {var} is equal to 1:
        send action bar "test1" to player
        set {var} to 2
        stop
    if {var} is equal to 2:
        send action bar "test2" to player
        set {var} to 3
        stop
    if {var} is equal to 3:
        send action bar "test3" to player
        set {var} to 1
        stop
    else:
        send action bar "test1" to player
        set {var} to 2
 
  • Love
Reactions: Diamendd