Solved Sidebar Players List

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

Yaşarhan

Active Member
May 16, 2020
87
6
8
23
Turkey Istanbul
Hello, thank you for your interest.

There are no errors in the code, it just doesn't work as intended.
I'm trying to list all the players in the loop-variable in the sidebar.

Code:
loop {party.%{Ownerofparty.%player%}%.list::*}:
    set {_Player} to player
    send "&9&l[SİSTEM] &7&l%{_Player}% &9&lAdlı oyuncu gruba katıldı." to loop-variable
 
    #Wrong working:
    set {_Player} to loop-variable
    delete loop-variable sidebar
    set name of sidebar of loop-variable to "&9&lGRUP"
    set {_n} to 1
        loop 6 times:
            set score "%{_Player}%" in sidebar of {_Player} to {_n}
            add 1 to {_n}

Code output: Listing a single player, each player sees their own name.
https://i.hizliresim.com/P9KU9k.png


An example like this is working:
Code:
loop {party.%{Ownerofparty.%player%}%.list::*}:
    set {_Player} to loop-variable
    message "{_Player}" to loop-variable
 
Last edited:
This should work.

Code:
        loop {party.%{Ownerofparty.%player%}%.list::*}:
            set {_n} to 1
            set {_Player1} to loop-value
            send "&9&l[SİSTEM] &7&l%{_Player1}% &9&lAdlı oyuncu gruba katıldı." to {_Player1}
        
            #Wrong working:
            set {_Player1} to loop-variable
            delete loop-variable sidebar
            set name of sidebar of loop-variable to "&9&lGRUP"
            loop {party.%{Ownerofparty.%player%}%.list::*}:
                set {_Player} to loop-variable-2
                set score "%{_Player}%" in sidebar of {_Player1} to {_n}
                add 1 to {_n}
 
  • Like
Reactions: Yaşarhan
This should work.

Code:
        loop {party.%{Ownerofparty.%player%}%.list::*}:
            set {_n} to 1
            set {_Player1} to loop-value
            send "&9&l[SİSTEM] &7&l%{_Player1}% &9&lAdlı oyuncu gruba katıldı." to {_Player1}
       
            #Wrong working:
            set {_Player1} to loop-variable
            delete loop-variable sidebar
            set name of sidebar of loop-variable to "&9&lGRUP"
            loop {party.%{Ownerofparty.%player%}%.list::*}:
                set {_Player} to loop-variable-2
                set score "%{_Player}%" in sidebar of {_Player1} to {_n}
                add 1 to {_n}

Thank you so much.
 
Status
Not open for further replies.