Need help with setting variable to scoreboard value

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

lolimtaco

Member
Mar 31, 2022
1
0
1
19
Hi, I'm really new to Skript and I am having some trouble trying to figure out how to assign a numerical scoreboard value to a variable.
Here is my code:
Code:
on rightclick:
    if held item is a diamond pickaxe with custom model data 1:
        set {Team} to the 1st line of lore of item
        execute command "scoreboard players add %{Team}% Goal 1"
        execute command "scoreboard players get %{Team}% Goal"
        set {TeamScore} to result
        execute command "hd setline Score 1 %{TeamScore}&"

What I am trying to do is when the player right clicks a diamond pickaxe, it will add 1 score to "Goal" for the lore of the item which works fine (and then set that score to the 1st line of a holographic display, but whenever I try to get the current "Goal" score of that team, it won't work. I cannot find any expression that would be able to replace result as that only works for a furnace.

Can anyone help?
 
Hi, I'm really new to Skript and I am having some trouble trying to figure out how to assign a numerical scoreboard value to a variable.
Here is my code:
Code:
on rightclick:
    if held item is a diamond pickaxe with custom model data 1:
        set {Team} to the 1st line of lore of item
        execute command "scoreboard players add %{Team}% Goal 1"
        execute command "scoreboard players get %{Team}% Goal"
        set {TeamScore} to result
        execute command "hd setline Score 1 %{TeamScore}&"

What I am trying to do is when the player right clicks a diamond pickaxe, it will add 1 score to "Goal" for the lore of the item which works fine (and then set that score to the 1st line of a holographic display, but whenever I try to get the current "Goal" score of that team, it won't work. I cannot find any expression that would be able to replace result as that only works for a furnace.

Can anyone help?
I'm not sure if that can be done using commands but if you download skbee you can create scoreboards with script and avoid console spam. Here is a tutorial on how to create them https://forums.skunity.com/threads/skbee-easy-tutorial-for-scoreboards.15198/
And a tip if want the scoreboard to be on just in the game you can do something like this
Code:
Command /leave:
    Trigger:
        Delete {game_scoreboard::%player%}
        #the rest of the code
Command /join:
    Trigger:
        Set {game_scoreboard::%player%} to true
        #code like teleport, items the player receive.
        While {game_scoreboard::%player%} exists:
            #player scoreboard follow the tutorial and don't forget wait a tick
 
Last edited:
Status
Not open for further replies.