import { world, system } from "@minecraft/server"
world.events.entityHit.subscribe(data => {
if (data.hitBlock) return;
const player = data.entity
if (data.hitEntity.hasTag('cps')) {
player.runCommandAsync('scoreboard players add @s cps 1')
}
})
system.runSchedule(() => {
for (const player of world.getPlayers()) {
const cps = getScore(player, 'cps')
if (getScore(player, 'cps') >= 1) {
player.runCommandAsync(`scoreboard players operation @s avgcps = @s cps`)
player.runCommandAsync('scoreboard players set @s cps 0')
player.tell(`§7[§6Server§7]: Your CPS was §e${cps}`)
}
if (cps >= 25) {
world.say(`§7[§cServer§7]: §e${player.nameTag}§7's CPS is above §c25`)
}
}
},20 )```\
https://youtu.be/MLjOc2PXvxU
#Basic CPS Counter with Scripts and Entities
1 messages · Page 1 of 1 (latest)
also went ahead and made an mcpack too if you wanna use it 🙂
^ this automatically makes the entity invincible youll have to setup your own tp command to keep it inthe location you want
I need tutorial by how to modify the scoreboard with json haha
Looks sick, good work
you used method the scoreboard