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

Meggy_Mode

Active Member
Aug 30, 2024
114
4
18
15
Hi I have been having a problem with this part in my skript:

code_language.skript:
else if block is stone:
        cancel event
        set event-block to bedrock
        give player {BlockAmount} cobblestone
        wait 5 seconds
        set event-block to stone

it keeps sending "cant be added to player b/c the former is not a item type, inv, ect."


full skript

code_language.skript:
on block damage:
    set {_MiningSpeed} to -2
    set {MiningFortune} to 0
    set {_BlockHardness} to 0
    set {BlockAmount} to 0
    if block is stone:
        add 0.1 to {_BlockHardness}
    
    if player is holding a pickaxe:
        set {_loreLine} to 2nd line of lore of player's tool
        set {_split::*} to split {_loreLine} by "&7Mining Speed:&a +"
        if {_split::2} is set:
            set {_n} to {_split::2} parsed as a number
            add ({_n} * 0.2) - {_BlockHardness} to {_MiningSpeed}
            set player's player.block break speed attribute to {_MiningSpeed}
        else:
            send "Failed to split lore or retrieve the number." and "Please notify an Admin for block breaking" to player

        set {_loreLine2} to 3nd line of lore of player's tool
        set {_split2::*} to split {_loreLine2} by "&7Fortune:&a +"
        if {_split2::2} is set:
            set {_n2} to {_split2::2} parsed as a number
            add {_n2} to {MiningFortune}
            set {_i} to {MiningFortune}
            send "%{MiningFortune}%"
            while {_i} >= 100:
                add -100 to {_i}
                add 1 to {BlockAmount}
                send "%{_i}%" to player
        else:
            send "Failed to split lore or retrieve the number." and "Please notify an Admin for fortune" to player




#============================================
#            Block Drops
#============================================
on block break:
    if player's held item is a stone pickaxe named "&rClear":
        send "Broken The Block" to player
    else if block is stone:
        cancel event
        set event-block to bedrock
        give player {BlockAmount} cobblestone
        wait 5 seconds
        set event-block to stone
    else if block is andesite:
        cancel event
        set event-block to bedrock
        give player 1 cobblestone
        if {MiningFortune} >= 100:
            give player 1 cobblestone
        wait 5 seconds
        set event-block to andesite
    else if block is coal ore:
        cancel event
        set event-block to bedrock
        give player 1 coal
        if {MiningFortune} >= 100:
            give player 1 coal
        wait 5 seconds
        set event-block to coal ore
    else:
        set {_null} to "null"
 
Just needed to add the "of" after the variable, checked and its working now.
Code:
else if block is stone:
        cancel event
        set event-block to bedrock
        give player {BlockAmount} of cobblestone #just needed to add of after the variable
        wait 5 seconds
        set event-block to stone