Solved Scoreboard update for a player

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

Aralwen

Active Member
May 26, 2017
164
14
18
25
Hello to you the skripters ! Today I block on the scoreboard.

Indeed, I try to define a scoreboard that displays the Y position of the player and that updates
at every change of position. The problem is that the new position is displayed to other players. I did not find in the documentation the way to update only for the player.

Code:

code_language.skript:
command /sc:
    trigger:
        erase player sidebar
        set name of sidebar of player to "Location"
        set id based score "&fY: &6&l%{_y}%" in sidebar of player to 0 with id "y"

on any move:
    set {y.%player%} to y coord of player
    edit score id "y" to "&fY: &6&l%{y.%player%}%" and 3

Doesn't work :emoji_frowning: :
code_language.skript:
edit score id "y" to "&fY: &6&l%{y.%player%}%" for player and 3

Thank's in advance for help.
 
This isn't related to the problem and neither it resolves the issue but anyways: you should always use list variables for those objects that you want to reference to something. So, your variable should be {y::%player's uuid%} rather than what you had there.

That said, you don't even need a variable for it (the above advice might be pointless for you now but it was more of a general advice rather than one about this general question). You just have to create the scoreboard, put it in a while loop checking whether the player is online and then edit the score every one second (or perhaps more).

I also recommend you to switch from skRayFall's scoreboards to Skoreboards (Skore is an scoreboard addon that hooks into TitleManager).
 
This isn't related to the problem and neither it resolves the issue but anyways: you should always use list variables for those objects that you want to reference to something. So, your variable should be {y::%player's uuid%} rather than what you had there.

That said, you don't even need a variable for it (the above advice might be pointless for you now but it was more of a general advice rather than one about this general question). You just have to create the scoreboard, put it in a while loop checking whether the player is online and then edit the score every one second (or perhaps more).

I also recommend you to switch from skRayFall's scoreboards to Skoreboards (Skore is an scoreboard addon that hooks into TitleManager).
Hello ! Thank you very much for introducing me to Skore, which is just revolution ! :emoji_relieved:
I will also pass my variables in UUID, thank you for this tip!
 
Status
Not open for further replies.