#Gametest

1 messages ยท Page 1 of 1 (latest)

unique aspen
#

has gametest changed or something? I cant seem to get my script to work anymore. ```import * as server from '@minecraft/server'
const world = server.world

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:dirt"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 5`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

})

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:diamond_ore"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 120`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

})

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:stone"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 20`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

})

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:gold_ore"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 60`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

})

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:lapis_ore"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 40`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

})

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:redstone_ore"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 25`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

})

world.events.blockBreak.subscribe((data) => {
const blocks = [
"minecraft:coal_ore"
]

let brokenBlock = data.brokenBlockPermutation.type.id;
let player = data.player;

if (blocks.includes(brokenBlock)) {
    player.runCommandAsync(`scoreboard players add @s money 15`)
    player.runCommandAsync(`scoreboard players add @s blockcount 1`);
}

}) ```

stray belfryBOT
#
Debug Result

JavaScript/TypeScript code blocks not detected in [message](#1109113238563590195 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.

sinful wharf
stray belfryBOT
#
No Errors

No errors in [code](#1109113238563590195 message)

sinful wharf
#

There's no errors

#

What exactly doesnt work?

unique aspen
#

When I load into the game & break a block that's stated on here, it will not add money or blocks, I have beta API's on as well

sinful wharf
#

Did it work before?

unique aspen
#

Yes it did

#

Worked perfectly

#
    "format_version": 2,
    "metadata": {
        "authors": [
            "Gods"
        ],
        "generated_with": {
            "dri": [
                "2.6.0"
            ],
            "dash": [
                "0.10.8"
            ]
        }
    },
    "header": {
        "name": "Mining script v.1",
        "description": "DHUB",
        "min_engine_version": [
            1,
            19,
            50
        ],
        "uuid": "b47a93b5-e6a5-4378-b8bc-6441fe27c79a",
        "version": [
            1,
            0,
            0
        ]
    },
    "modules": [
        {
            "type": "data",
            "uuid": "746d115f-9db9-4d5a-a000-b669999686d2",
            "version": [
                1,
                0,
                0
            ]
        },
        {
            "type": "script",
            "language": "javascript",
            "uuid": "e39a7659-e3b7-4f04-a3d0-242e67aadd1c",
            "entry": "scripts/main.js",
            "version": [
                1,
                0,
                0
            ]
        }
    ],
    "dependencies": [
        {
            "module_name": "@minecraft/server",
            "version": "1.1.0"
        },
        {
            "module_name": "@minecraft/server-gametest",
            "version": "1.0.0-beta"
        },
        {
            "module_name": "@minecraft/server-ui",
            "version": "1.0.0-beta"
        }
    ]
}```
#

Heres the manifest file

sinful wharf
#

Could you try using 1.2.0 for the server module. Try that or check to see if the command can run in chat. Use console.warn to see if the script is actually running when you break a block

unique aspen
#

Ok that worked never mind

#

you're amazing

#

honest life saver

#

you saved a lot of my time

sinful wharf
#

๐Ÿ™Œ Nice glad to see it got resolved

harsh thicket
#

versions exist so that stuff doesnt break