#Script to print out messages in chat after a certain amount of time/ticks
8 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
ServerEvents.tick(event => {
if(event.server.getLevel("minecraft:overworld").time % 10000 == 0){
// code here runs every 10000 ticks, so every 500 seconds
}
})
i want to run it after a specific day ingame
do i jst replace the 0 in the script with 1 etc?
so what the code uses is a % operator
This divides and gives the rest amount, so for example 100 % 33 would give 1 (100-3*33=1)
if you want it to only trigger at a specfic time you can just do js if (event.server.getLevel("minecraft:overworld").time == 2000) { // code here runs once when time in ticks reaches 2000 }
perfect thank yo so much
Note that this will only print the message a single time for every world
From a performance standpoint, this should be done via a scheduled tick function on world startup, rather than on server tick.