Solved skript doesnt work

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

bewf

Member
Apr 19, 2024
30
0
6
24
my skript doesnt work, not error wise, but it legit doesnt do anything,
here are the plugins I have:
skript, skbee, skdragon, skellett, skquery, skrayfall, skript-gui


if im missing any that would be needed for this lmk

Code:
on region enter:
    if "%event-region%" contains "heart":
        if max health of player is greater than or equal to 40:
            send "&eYou're at &cmax health" to player
            stop
    else if player's level is less than 100:
        if "%event-region%" contains "heart":
            send "&eYou do not have enough &bexperience." to player
            stop
    else:
        "%event-region%" contains "heart":
            if player's level is less than or equal to 100:
                if max health of player is 20:
                    set max health of player to 22
                    set player's level to 0
                    send "&aYou're now at 11 hearts!" to player
                if max health of player is 22:
                    set max health of player to 24
                    set player's level to 0
                    send "&aYou're now at 12 hearts!" to player
                if max health of player is 24:
                    set max health of player to 26
                    set player's level to 0
                    send "&aYou're now at 13 hearts!" to player
                if max health of player is 26:
                    set max health of player to 28
                    set player's level to 0
                    send "&aYou're now at 14 hearts!" to player
                if max health of player is 28:
                    set max health of player to 30
                    set player's level to 0
                    send "&aYou're now at 15 hearts!" to player
                if max health of player is 30:
                    set max health of player to 32
                    set player's level to 0
                    send "&aYou're now at 16 hearts!" to player
                if max health of player is 32:
                    set max health of player to 34
                    set player's level to 0
                    send "&aYou're now at 17 hearts!" to player
                if max health of player is 34:
                    set max health of player to 36
                    set player's level to 0
                    send "&aYou're now at 18 hearts!" to player
                if max health of player is 36:
                    set max health of player to 38
                    set player's level to 0
                    send "&aYou're now at 19 hearts!" to player
                if max health of player is 38:
                    set max health of player to 40
                    set player's level to 0
                    send "&aYou're now at max hearts!" to player
Code:
 
at the top you call
code_language.skript:
if "%event-region%" contains "heart":
    if max health of player is greater than or equal to 40:
        send "&eYou're at &cmax health" to player
        stop
    else if player's level is less than 100:
        if "%event-region%" contains "heart":
            send "&eYou do not have enough &bexperience." to player
            stop
however the code that sends send "&eYou do not have enough &bexperience." to player will never run because its in an else if.

The same else reason for the second, fixed & cleaned code:
code_language.skript:
on region enter:
    if "%event-region%" contains "heart":
        if max health of player is greater than or equal to 40:
            send "&eYou're at &cmax health" to player
            stop
        else:
            if player's level is less than 100:
                send "&eYou do not have enough &bexperience." to player
                stop
                if max health of player is between 20 and 38:
                    set {_h} to max health of player
                    add 2 to {_h}
                    set max health of player to {_h}
                    set player's level to 0
                    if {_h} is not 40:
                        send "&aYou're now at %{_h} divided by 2% hearts!" to player
                    else:
                        send "&aYou're now at max hearts!" to player
 
at the top you call
code_language.skript:
if "%event-region%" contains "heart":
    if max health of player is greater than or equal to 40:
        send "&eYou're at &cmax health" to player
        stop
    else if player's level is less than 100:
        if "%event-region%" contains "heart":
            send "&eYou do not have enough &bexperience." to player
            stop
however the code that sends send "&eYou do not have enough &bexperience." to player will never run because its in an else if.

The same else reason for the second, fixed & cleaned code:
code_language.skript:
on region enter:
    if "%event-region%" contains "heart":
        if max health of player is greater than or equal to 40:
            send "&eYou're at &cmax health" to player
            stop
        else:
            if player's level is less than 100:
                send "&eYou do not have enough &bexperience." to player
                stop
                if max health of player is between 20 and 38:
                    set {_h} to max health of player
                    add 2 to {_h}
                    set max health of player to {_h}
                    set player's level to 0
                    if {_h} is not 40:
                        send "&aYou're now at %{_h} divided by 2% hearts!" to player
                    else:
                        send "&aYou're now at max hearts!" to player
Thank you lots, this was the first script I tried writing and I couldn't figure out the heart adding system. I'm still learning :emoji_stuck_out_tongue: