HUGE lag with scoreboard?

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

    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.

MCProHost

Active Member
Sep 17, 2017
80
0
0
every 19 seconds:
loop all players:
set {onlineplayers} to amount of players

every 20 seconds:
loop all players:
wipe loop-player's sidebar
display board named "&8&l&m-+- &c&lDEV &8&l&m-+-" to loop-player
make score of "&F&m&l------------------" in board of loop-player to 40
make score of "&7" in board of loop-player to 39
make score of "&2&lMoney" in board of loop-player to 38
make score of "%{Money::%loop-player%}%" in board of loop-player to 37
make score of "&7" in board of loop-player to 36
make score of "&3&lRank" in board of loop-player to 35
make score of "%{Rank::%loop-player%}%" in board of loop-player to 34
make score of "&e" in board of loop-player to 33
make score of "&e&LPlayer Count" in board of loop-player to 32
make score of "%{onlineplayers}%" in board of loop-player to 31
make score of "&8" in board of loop-player to 30
make score of "&F&m&l-------------------" in board of loop-player to 29
move display of loop-player to sidebar


No errors
latest stable build of skript...
Spigot 1.8.9

When the skript is enabled every 20 seconds the server has a huge lag spike, without it enabled it runs fine.
 
Periodicals are supposedly supposed to be laggy plus theres no reason to have two of them the way you have it now
code_language.skript:
on script load:
    while true is true:
        loop all players:
            wipe loop-player's sidebar
            display board named "&8&l&m-+- &c&lDEV &8&l&m-+-" to loop-player
            make score of "&F&m&l------------------" in board of loop-player to 40
            make score of "&7" in board of loop-player to 39
            make score of "&2&lMoney" in board of loop-player to 38
            make score of "%{Money::%loop-player%}%" in board of loop-player to 37
            make score of "&7" in board of loop-player to 36
            make score of "&3&lRank" in board of loop-player to 35
            make score of "%{Rank::%loop-player%}%" in board of loop-player to 34
            make score of "&e" in board of loop-player to 33
            make score of "&e&LPlayer Count" in board of loop-player to 32
            make score of "%number of all players%" in board of loop-player to 31
            make score of "&8" in board of loop-player to 30
            make score of "&F&m&l-------------------" in board of loop-player to 29
            move display of loop-player to sidebar
            wait 20 seconds
i changed the player count line so you dont need 2 periodicals and if youre still having lag then it would be even better to only update the scoreboard when a value on it changes
 
Thanks, Ill get back too you!
[doublepost=1505959534,1505959485][/doublepost]Error output:
[21:03:48 ERROR]: 'wipe loop-player's sidebar' is not a boolean (yes/no) (scoreboard.sk, line 3: wipe loop-player's sidebar')
[21:03:48 ERROR]: 'display board named "&8&l&m-+- &c&lDEV &8&l&m-+-" to loop-player' is not a boolean (yes/no) (scoreboard.sk, line 4: display board named "&8&l&m-+- &c&lDEV &8&l&m-+-" to loop-player')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 40' (scoreboard.sk, line 5: make score of "&F&m&l------------------" in board of loop-player to 40')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 39' (scoreboard.sk, line 6: make score of "&7" in board of loop-player to 39')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 38' (scoreboard.sk, line 7: make score of "&2&lMoney" in board of loop-player to 38')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 37' (scoreboard.sk, line 8: make score of "%{Money::%loop-player%}%" in board of loop-player to 37')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 36' (scoreboard.sk, line 9: make score of "&7" in board of loop-player to 36')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 35' (scoreboard.sk, line 10: make score of "&3&lRank" in board of loop-player to 35')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 34' (scoreboard.sk, line 11: make score of "%{Rank::%loop-player%}%" in board of loop-player to 34')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 33' (scoreboard.sk, line 12: make score of "&e" in board of loop-player to 33')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 32' (scoreboard.sk, line 13: make score of "&e&LPlayer Count" in board of loop-player to 32')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 31' (scoreboard.sk, line 14: make score of "%number of all players%" in board of loop-player to 31')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 30' (scoreboard.sk, line 15: make score of "&8" in board of loop-player to 30')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to 29' (scoreboard.sk, line 16: make score of "&F&m&l-------------------" in board of loop-player to 29')
[21:03:48 ERROR]: There's no loop that matches 'loop-player to sidebar' (scoreboard.sk, line 17: move display of loop-player to sidebar')
 
I forgot to put loop all players the first time and edited it in a few seconds later did you see that?
 
Still a noticeable lag spike, but it didn't last as long...
[doublepost=1505960021,1505959721][/doublepost]
if youre still having lag then it would be even better to only update the scoreboard when a value on it changes
How would I do this?
 
Still a noticeable lag spike, but it didn't last as long...
Yeah im not surprised so if i were you i would create the scoreboard for everyone when they join the server and then also update everybody's scoreboard (only the player count line not the whole scoreboard) when a player joins the server.

Then for balance changes idk if youre using essentials or a custom money but if youre using essentials wolvsk has a on balance change event so on that event you could update just the scoreboard of the affected player and only the balance line of the scoreboard
 
Everything on my server is made with skript! xD
So just create a function with a player argument that updates the balance line of player's scoreboard and call the function anywhere a player's balance is changed i.e. on command /pay
 
When the time comes... xD What about the player count though?
[doublepost=1505960524,1505960478][/doublepost]Never mind I'm just not going to use a scoreboard, anyway I could add you on discord?
 
When the time comes... xD What about the player count though?
[doublepost=1505960524,1505960478][/doublepost]Never mind I'm just not going to use a scoreboard, anyway I could add you on discord?
Look a couple posts up for the player count if you decide to make it.

My discord is Donut #2129

Theres donuts emojis next to it that didnt show up so just look for me in the skript discord
 
Status
Not open for further replies.