#Time played

4 messages · Page 1 of 1 (latest)

sullen torrent
#

I want to create a scoreboard that comes up when people press tab that gives a time played hours and minutes or something somewhere where the player can disable and enable it or just appears for 10 seconds every 5 minutes

if (global.playtimeHandlerLoaded) {
  console.log("Playtime TAB script already loaded — skipping duplicate.");
  // Prevent duplicate reload registration
} else {
  global.playtimeHandlerLoaded = true;
  ServerEvents.tick(event => {
    if (event.server.ticks % 200 == 0) {
      event.server.players.forEach(p => {
        let ticks = p.stats.get("minecraft:custom", "minecraft:play_time");
        let hours = Math.floor(ticks / 72000);
        let mins = Math.floor((ticks % 72000) / 1200);
        p.setTabListDisplayName(`${p.name.string} §7(${hours}h ${mins}m)`);
      });
    }
  });
  console.log("✅ Playtime TAB updater loaded.");
}

This is the script in question, I tried my best I really suck at coding so I hope I did it correctly if anyone can help that'd be really appreciated

valid houndBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

sullen torrent
#

Guess someone didnt read

#

it has NOT been resolved