#.scoreboardIdentity stopped working

1 messages · Page 1 of 1 (latest)

rugged wagon
#

a lot of the start of the log is unrelated

#

just me debugging

edgy delta
#

show the code.

rugged wagon
# edgy delta show the code.

i’ll just send my scripts folder, you dont seem to understand, it’s in EVERY SINGLE SCRIPT FILE WITH SCOREBOARD

#

give me a sec

edgy delta
#

if I help with 1 script, it can help you fix the others.

rugged wagon
edgy delta
#

what do you think??

rugged wagon
#

fine, ill send the entire setActionBar.js file in message

edgy delta
#

what the logs are referencing.

rugged wagon
#
import { system, world } from "@minecraft/server"

let lastTickTime = Date.now();
function lagReaderServerMs() {
    const currentTime = Date.now();
    const tickDuration = currentTime - lastTickTime;
    lastTickTime = currentTime;
    const expectedTickDuration = 50; // 1 tick = 50 ms
    const lag = tickDuration - expectedTickDuration;
    return { lag }
}
let checkTime = Date.now();
let currentTicks = 0;
let tps = 0;
function lagReaderTps() {
    currentTicks++;
    const currentTime = Date.now();
    if (currentTime - checkTime > 970) {
        tps = currentTicks;
        checkTime = currentTime;
        currentTicks = 0;
    }
    return { tps }
}
system.runInterval(() => {
    const tps = lagReaderTps().tps;
    const lag = lagReaderServerMs().lag;
    const absLag = lag < 0 ? 0 : lag
    const color = ['a', 'e', 'g', '6', 'c', '4'];
    for (const player of world.getPlayers()) {
        const coins = world.scoreboard.getObjective("coins").getScore(player.scoreboardIdentity)
        const kills = world.scoreboard.getObjective("kills").getScore(player.scoreboardIdentity)
        const deaths = world.scoreboard.getObjective("deaths").getScore(player.scoreboardIdentity)
        player.onScreenDisplay.setActionBar(`§eCoins: ${coins} \n${world.scoreboard.getObjective("ascensionPoints").getScore(player.scoreboardIdentity) === undefined || world.scoreboard.getObjective("ascensionPoints").getScore(player.scoreboardIdentity) === 0 ? "" : `§5Ascension Points: ${world.scoreboard.getObjective("ascensionPoints").getScore(player.scoreboardIdentity)}§r\n`}§aKills: ${kills}\n§cDeaths: ${deaths}\n§r§${Math.floor(absLag / 10) >= color.length ? '4' : color[Math.floor(absLag / 10)]}${absLag} ms §i|§r Ticks/s: §b${tps}`);
    }
});```
#

ther

#

so line 31 is where it starts in that file alone

edgy delta
#

the player is not a participant yet.

rugged wagon
#

wh

#

HOW DO I FIX TAHT

edgy delta
#

it can be 0

rugged wagon
edgy delta
#

so use world.afterEvents.playerSpawn...

#

give them a score 0.

#

this should fix this issue.

rugged wagon
#

ok.

rugged wagon
#

in a new script file, ill add all spawning players 0 to every score

#

at least i have logic to check for score 0 to not show it…

edgy delta
rugged wagon
#

but in script form

#

you should get it

edgy delta
#

do you understand why im suggesting this

rugged wagon
#

Actually I have a .mcfunction that already does that for coins, kills, and deaths

rugged wagon
#

it’s been holding me well

#
execute as @a[scores={coins=!-2147483647..}] run scoreboard players add @a coins 0```