Here's a simple TPS counter (Tick per Second) for anyone who just wants to copy-paste it into their code.
TPS here (The one you want to use) is a decimal number. You can round it to the nearest integer if you like.
import { system } from "@minecraft/server"
const interval = 10 //delay between check
let TPS = 20 //Use this on the rest of your codes
let lastDate = Date.now()
system.runInterval(()=>{
const currDate = Date.now()
TPS = interval*50/(currDate-lastDate)*20
lastDate = currDate
},interval)
Other variations:
- [Visual1mpact's]( #1281437513675964446 message)