#Why does this scoreboard crash my server?

1 messages · Page 1 of 1 (latest)

dull finch
#
    while player is online:
        if player is in world "serverspawn":
            wait 8 ticks        
            set title of player's board to "&8&l[&b&lDiamondCent&8&l]"
            set line 1 of player's board to "&7Players online &8[&f%amount of all players%&8]"
            set line 2 of player's scoreboard to " "
            set line 3 of player's scoreboard to "DiamondGems: %{diamondgems::%player%}%" # or any other currency, if theres coins im doing diamondgemms
            set line 4 of player's scoreboard to "Wins: %{wins::%player%}%"
            set line 5 of player's scoreboard to " "
            set line 6 of player's scoreboard to "&bDiamondCent.minehut.gg"
        else if player is in world "Schmiede":
            wait 8 ticks            
            toggle player's board off
            clear player's board```
The server crashes everytime it goes to the world Schmiede or any other world besides serverspawn.

Crash Logs:
loud gust
#

if the player is not in the world "serverspawn", it's not going to wait

#

therefore the while loop will crash

fringe sigil
#

^

#

i always put the wait immediately after the while loop so i know i dont forget it or make it not run

fringe sigil
#

yes

#

but its inside a condition

#

if that condition doesnt pass it wont wait

#

oh, you put it in both conditions, i see what you mean

fringe sigil
loud gust
#

also yeah its better to put shared code outside of conditions

#
    if name of event-inventory = "SHOP":
        cancel event
        # etc
    else if name of event-inventory = "SHOP 2":
        cancel event
        # etc```
->
```on inventory click:
    cancel event
    if name of event-inventory = "SHOP":
        # etc
    else if name of event-inventory = "SHOP 2":
        # etc```
#

makes it easier to read

#

less code to write

#

overall just a nicer experience

dull finch
# fringe sigil oh, you put it in both conditions, i see what you mean
    wait 8 ticks
    while player is online:
        if player is in world "serverspawn":     
            set title of player's board to "&8&l[&b&lDiamondCent&8&l]"
            set line 1 of player's board to "&7Players online &8[&f%amount of all players%&8]"
            set line 2 of player's scoreboard to " "
            set line 3 of player's scoreboard to "DiamondGems: %{diamondgems::%player%}%" # or any other currency, if theres coins im doing diamondgemms
            set line 4 of player's scoreboard to "Wins: %{wins::%player%}%"
            set line 5 of player's scoreboard to " "
            set line 6 of player's scoreboard to "&bDiamondCent.minehut.gg"
        else if player is in world "Schmiede":      
            toggle player's board off
            clear player's board```
#

so like this?

fringe sigil
#

That seems like what we suggested

fringe sigil
#

I would also recommend uuid vars

dull finch
#

so the wait 8 ticks will only happen once basically

fringe sigil
#

Yes

#

The wait after the loop

#

Not before

dull finch
#
    while player is online:
        if player is in world "serverspawn":     
            set title of player's board to "&8&l[&b&lDiamondCent&8&l]"
            set line 1 of player's board to "&7Players online &8[&f%amount of all players%&8]"
            set line 2 of player's scoreboard to " "
            set line 3 of player's scoreboard to "DiamondGems: %{diamondgems::%player%}%" # or any other currency, if theres coins im doing diamondgemms
            set line 4 of player's scoreboard to "Wins: %{wins::%player%}%"
            set line 5 of player's scoreboard to " "
            set line 6 of player's scoreboard to "&bDiamondCent.minehut.gg"
        else if player is in world "Schmiede":      
            toggle player's board off
            clear player's board
    wait 8 ticks```
#

Making sure one last time

#

THIS CODE will work right?

topaz portal
#

Your wait is not inside the while loop

dull finch
topaz portal
#

it's not in either while loop
you just have it wait for nothing, actually it can't even be reached

dull finch
topaz portal
#

you say it crashes the world?

dull finch
#

and to be more specific, the serverspawn world doesn't crash the world but when your in Schmiede then the world crashes.

topaz portal
topaz portal
dull finch
#

Well I thought that would stop it since the original didn't have it before.

topaz portal
#

I don't think it's necessary to toggle it off and clear it

dull finch
#

so how do I fix it?

#

Do I just set another scoreboard because idk if it will work.

topaz portal
#

try like

on join:
  while player is online:
    wait 8 ticks
    # the rest of your code```
and try removing `clear player's scoreboard`
I can't be certain that'll fix it completely but I'm just tryna simplify your code
dull finch
#

k

fringe sigil
#

One of the first suggestions