#Trying to write a script to kick players
1 messages · Page 1 of 1 (latest)
import { system } from "@minecraft/server"
const dimension = world.getDimension("overworld")
system.runInterval(() => {
for (const player of world.getPlayers()) {
if (!player.hasTag("Banned")) continue;
dimension.runCommandAsync(`kick ${player.name}`)
}
})
Import world? And maybe add the tick delay in the runinterval
you can do player.runCommandAsync("kick @s")
no u cant
import { system, world } from "@minecraft/server"
system.runInterval(() => {
for (const player of world.getPlayers()) {
if (!player.hasTag("Banned")) continue;
player.runCommandAsync(`kick ${player.name}`)
}
})```
try that
You goddam legened! It works flawlessly
Is there a way i can add a reason for the kick
yes u can just add it after the player in the kick
like so
import { system, world } from "@minecraft/server"
system.runInterval(() => {
for (const player of world.getPlayers()) {
if (!player.hasTag("Banned")) continue;
player.runCommandAsync(`kick ${player.name} you have been banned!!`)
}
})```