#Crash game

1 messages · Page 1 of 1 (latest)

raw bridge
#

idk why it makes the game crash

import { world, system, TicksPerSecond } from "@minecraft/server";
import { dragonFamily, getEntityCom } from "../entry";

system.runInterval(() => {
    world.getAllPlayers().forEach( player => {
            const checkRide = getEntityCom(player,"riding");
            const rot = player.getRotation().x;
            if ((rot <= 13 ) && (checkRide != undefined && dragonFamily.includes(checkRide.entityRidingOn.typeId)) && !player.hasTag("fly") && !player.hasTag("flymin")) {
                player.addTag("fly");
                player.addTag("flymin");
                onFlap(player);
            }
    })
}, TicksPerSecond * 0)
//On Flap
function onFlap(player, delay = 0) {
                player.runCommandAsync('/function dragon/onflap');
                animFinish(player);

                console.warn("onFlap");

                let interval = system.runInterval(() => {
                        const checkRide = getEntityCom(player,"riding");
                        if (checkRide == undefined || (checkRide != undefined && !dragonFamily.includes(checkRide.entityRidingOn.typeId)) || !player.hasTag("flymin")) { 
                            onExit(player);
                            system.clearRun(interval);
                        }
                    }, TicksPerSecond * delay);

                return interval;
}

function onExit(player) {
                player.runCommandAsync('/function dragon/onflap_end');
                //return system.runTimeout(() => {
                player.removeTag("fly");
                player.removeTag("flymin");
                console.warn("onExit");
                //},1)
}

function animFinish(player) {
    return system.runTimeout(() => {
        player.removeTag("flymin");
    }, 10)
}

//Debug
console.warn("flap")
dense bloom
#

ill try to help

#

maybe the cause is in the entry file, btw dont use / in runComman/Async

raw bridge
dense bloom
raw bridge
#

idk

gray surgeBOT
#
Debug Result

JavaScript/TypeScript code blocks not detected in [message](#1236318435399569448 message).
You can either send the script in code block highlighted in JS format:

​`​`​`js
world.sendMessage("Hello World");
​`​`​`

Or Send an attachment end in .js to debug the file.

#
Debug Result

JavaScript/TypeScript code blocks not detected in [message](#1236318435399569448 message).
You can either send the script in code block highlighted in JS format:

​`​`​`js
world.sendMessage("Hello World");
​`​`​`

Or Send an attachment end in .js to debug the file.

halcyon lynx
#

idk why it makes the game crash


import { world, system, TicksPerSecond } from "@minecraft/server";
import { dragonFamily, getEntityCom } from "../entry";

system.runInterval(() => {
    world.getAllPlayers().forEach( player => {
            const checkRide = getEntityCom(player,"riding");
            const rot = player.getRotation().x;
            if ((rot <= 13 ) && (checkRide != undefined && dragonFamily.includes(checkRide.entityRidingOn.typeId)) && !player.hasTag("fly") && !player.hasTag("flymin")) {
                player.addTag("fly");
                player.addTag("flymin");
                onFlap(player);
            }
    })
}, TicksPerSecond * 0)
//On Flap
function onFlap(player, delay = 0) {
                player.runCommandAsync('/function dragon/onflap');
                animFinish(player);

                console.warn("onFlap");

                let interval = system.runInterval(() => {
                        const checkRide = getEntityCom(player,"riding");
                        if (checkRide == undefined || (checkRide != undefined && !dragonFamily.includes(checkRide.entityRidingOn.typeId)) || !player.hasTag("flymin")) { 
                            onExit(player);
                            system.clearRun(interval);
                        }
                    }, TicksPerSecond * delay);

                return interval;
}

function onExit(player) {
                player.runCommandAsync('/function dragon/onflap_end');
                //return system.runTimeout(() => {
                player.removeTag("fly");
                player.removeTag("flymin");
                console.warn("onExit");
                //},1)
}

function animFinish(player) {
    return system.runTimeout(() => {
        player.removeTag("flymin");
    }, 10)
}

//Debug
console.warn("flap")
gray surgeBOT
#
Debug Result

There is an error in this [code](#1236318435399569448 message):

<repl>.js:3:44 - error TS2307: Cannot find module '../entry' or its corresponding type declarations.

3 import { dragonFamily, getEntityCom } from "../entry";
                                             ~~~~~~~~~~