#Have this script, wont work with new update, any way i can fix it, i dont script

1 messages · Page 1 of 1 (latest)

lean dune
#

I was planning to release my realm this Friday but I guess plans change, just need it as fast as possible

unreal knollBOT
#
Debug Result

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

azure osprey
tribal wyvernBOT
#
Program Output
(node:22) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use ​`node --trace-warnings ...​` to show where the warning was created)
/home/jail/prog.js:1
import {
^^^^^^

SyntaxError: Cannot use impor
unreal knollBOT
#
Debug Result

There are 2 errors in this [code](#1100963388173070358 message):

index.js:34:11 - error TS2740: Type 'Entity' is missing the following properties from type 'Player': level, name, onScreenDisplay, selectedSlot, and 16 more.

34     const player = data.source
             ~~~~~~
index.js:48:37 - error TS2552: Cannot find name 'MoneyTransfer'. Did you mean 'moneyTransfer'?

48         if (result.selection === 1) MoneyTransfer(player)
                                       ~~~~~~~~~~~~~

  index.js:109:7
    109 const moneyTransfer = (player) => {
              ~~~~~~~~~~~~~
    'moneyTransfer' is declared here.

#
Debug Result

There are 7 errors in this [code](#1100963388173070358 message):

@minecraft/server-editor.d.ts:11:10 - error TS2305: Module '"@minecraft/server"' has no exported member 'Events'.

11 import { Events, Player, System, Vector3 } from "@minecraft/server";
            ~~~~~~
index.js:29:7 - error TS2339: Property 'events' does not exist on type 'World'.

29 world.events.beforeItemUse.subscribe(data => {
         ~~~~~~
index.js:48:37 - error TS2552: Cannot find name 'MoneyTransfer'. Did you mean 'moneyTransfer'?

48         if (result.selection === 1) MoneyTransfer(player)
                                       ~~~~~~~~~~~~~

  index.js:109:7
    109 const moneyTransfer = (player) => {
              ~~~~~~~~~~~~~
    'moneyTransfer' is declared here.
index.js:121:40 - error TS2538: Type 'false' cannot be used as an index type.

121         const selectedPlayer = players[dropdown];
                                           ~~~~~~~~
index.js:121:40 - error TS2538: Type 'true' cannot be used as an index type.

121         const selectedPlayer = players[dropdown];
                                           ~~~~~~~~
index.js:126:25 - error TS2339: Property 'includes' does not exist on type 'string | number | boolean'.
  Property 'includes' does not exist on type 'number'.

126         } if (textField.includes("-")) {
                            ~~~~~~~~
index.js:130:13 - error TS2365: Operator '<' cannot be applied to types 'number' and 'string | number | boolean'.

130         if (getScore('money', player) < textField) {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

lean dune
#

So how do I fix that? I don’t know how to code, it was given to me

lean dune
azure osprey
#

I don't know

lean dune
#

So you tried to fix it and that’s the attempt I’m guessing?

azure osprey
#

The form opens and I don't think there's an error

lean dune
#

Well, after the update I can’t even open the gui like I normally could

azure osprey
#

Send your manifest.json

lean dune
#

Sorry, I’m stupid, what’s that again?

#

What I sent before is the entire code

azure osprey
#

Send your manifest.json:
manifest.json file is a file that contains information about a data pack. A data pack is a collection of files that can be used to customize Minecraft gameplay mechanics, such as adding new crafting recipes, modifying loot tables, or creating new advancements.

The manifest.json file contains metadata about the data pack, such as its name, description, and version number. It also lists the files that make up the data pack and specifies their location within the file structure. Minecraft uses this information to properly load and enable the data pack in-game.

lean dune
#

Yeah, then that should be in what I already sent

azure osprey
#

I cannot se one

lean dune
#

If you want me to, I can send you the entire file and compress it to a zip file so I can send it

azure osprey
#

Yes, Send your files

lean dune
#

Will do! Getting on my computer right now!

#

i didnt compress it to zip, it is letting me send normally

#

oh well its multiple files if that makes sense, it didnt send as normally

#

oh now i see the manifest

azure osprey
#

I believe you need to change the version to 1.2.0-beta: {
"module_name": "@minecraft/server",
"version": "1.1.0-beta"
}

lean dune
#

okay, so how woul i fix it

#

would*

#

just change the name?

#

i changed it to 1.2.0

azure osprey
lean dune
#

so if i use that, it should work?

azure osprey
#

I believe so:

lean dune
#

alright ill check!

#

also another question

#

sorry

#

so when i want to replace the behavior pack with a newer version, it doesnt update, like the changes arent made, is there a reason for that?

azure osprey
#

Where did you put the new file?

lean dune
#

i always put it in behavior packs

azure osprey
#

It is recormended that you packs into development folders

#

You should move the pack from the world folder

lean dune
#

well its in a realm, not in a world

#

so whenever i replace it in developement folder, it should be updated with the new one?

azure osprey
#

Your going to need someone that know there stuff with realms

lean dune
#

well, what if i just download a backup and do it on the world then put the world in the realm

azure osprey
#

I believe so

lean dune
#

okay, and you said put it directly onto the world

azure osprey
#

So your new manifest has been applied?

#

To the pack

lean dune
#

yeah i checked it has, now i just need to get the world then put it in the world

#

do i remove the older one from my packs?

azure osprey
#

Yes, Just download the one I sent and put your older one on your desktop and add the new one

#

Don't delete just in case something goes wrong

lean dune
#

okay, so just to make sure, i take the older one put it on my desktop and the new one, instead of putting where the old one was, i put it directly into the world

azure osprey
#

Yes

lean dune
#

alright

azure osprey
#

So your manifest changes are reflected onto the world

lean dune
#

alright, well there are no development bahavior packs for the world just normal behavior

azure osprey
#

Ok, Just use what you would normally use

lean dune
#

alright

azure osprey
#

behaviour_packs

lean dune
#

okay its in

#

now ill restart my mc and see if it worked

azure osprey
#

Excellent!

lean dune
#

dude thankyou sm for helping me btw, you have no idea

#

do i just load into the world and see if it works?

azure osprey
#

Yes, Run your code like you have done so as normally

lean dune
#

alright

azure osprey
#

Wait, The pack is still applied to the world?

#

If so good, else add it

lean dune
#

it doesnt work :/

#

let me go look at the packs

#

yeah it didnt add for some reason

azure osprey
#

I will try your pack

lean dune
#

and the older pack is still here

#

okay, it uses a compass

azure osprey
#

Yes

#

Are there errors?

lean dune
#

i dont know

azure osprey
lean dune
#

dude what

#

how

azure osprey
#

I just imported your fixed pack

lean dune
#

i think the problem for me is, the pack never gets removed from "my packs" the older one ofc

#

i remove it, it just stays there for some reason

azure osprey
lean dune
#

okay, how would i do that, cause the one that is in behavior that shuldnt be is already gone

azure osprey
#

Go to your packs > behaviour > click the pack we are talking about > look for a red X button > click it

#

In game

#

On realm settings

lean dune
#

alright

#

so it doesnt pop up in my realm stuff, only pops up in my world

#

like in my packs

#

and there is no x

azure osprey
#

So your newer pack is working on your local world?

lean dune
#

no

azure osprey
#

Download your realm back-up and delete the old pack

lean dune
#

okay

#

just did, now ill put the new one in and see if it works

azure osprey
#

And import the new pack and apply it to this world you downloaded and add it to there, Upload this new world to the realm

lean dune
#

alright

#

it works! in the world, except for money transfer

#

Money transfer wont open

azure osprey
#

I will check

lean dune
#

alright!

azure osprey
#

Should I make your code better and cleaner?

#

Modifying your code

lean dune
#

wym?

#

what will that do

azure osprey
#

Make the code cleaner to look at and use better method of doing stuff in the gui

lean dune
#

i mean anything that helps would be great lmfao, and if possible ofc, could you make sure money transfer would work with a scoreboard objectives money lowercase m

#

oh then yes please

azure osprey
#

Yes!

lean dune
#

thankyou sm

azure osprey
#

Would you want to use: myFormDefinition (player) => { ... }

#

The name is an example

lean dune
#

i dont know what that would do to be honest

#

anything that makes it better lmfao

azure osprey
#

Using that instead of functions

lean dune
#

sure!

azure osprey
#

Also I believe I found an error for why your money transfer won't open: .body('') you have not use any strings for this function

#

You must provide one: §r

lean dune
#

oh alright

#

will i be able to use it with a scireboard objectives money strictly lowercase m lmfao

azure osprey
#

Yes, You can us dthe build in function: example.toLowerCase();

lean dune
#

i mean dont all the money stuff just need to be lowercase?

#

i mean whatever works!

azure osprey
#

Also I found a type: MoneyTransfer instead of: moneyTransfer

lean dune
#

oh that may have been the problem

azure osprey
#

Also you can use: warps.show(player).then(result => {

#

Instead of warps.then(

lean dune
#

what does that do

#

sorry i dont code so i dont know what any of this doe

azure osprey
#

I believe is parses the results

lean dune
#

does

#

parses the results?

azure osprey
#

Well this is an opportunity for you learn new stuff!

lean dune
#

yeah!

azure osprey
#

Return the result for processing should I say

#

Pass

lean dune
#

do you think it would make i easier and better?

#

are you able to test it whenever you finsih it to see if the money transfer works with a scoreboard of money

lean dune
#

@azure osprey

azure osprey
#

Yes, I'm still here doing it, It took so long as I don't have a computer, But you will be laughing when you see your new code

lean dune
#

Lmfao why will I be laughing

azure osprey
#

Because its the best code you have ever seen!

#

Just a trying it out now

lean dune
#

oh my god thankyou

#

dude, your helping sm right now man, i thought i would have to delay my realm release

lean dune
#

does it work?

limber gulch
#

Hi @lean dune ! Just a heads up these APIs break all the time. It sounds like you have an interest, so I recommend watching the main chat and picking up a tutorial on Javascript basics. Don’t be intimidated by it though. It’s totally something you can learn even if you didn’t have a computer science background.

lean dune
#

ive tried to look at things like that, and i just seem so stupid compared to that, i have no idea what any of that does means nothing, i would have to do everything x5 to remember it

#

just slightly remember it

limber gulch
#

It’s really tun to learn and experiment with and these skill can be very useful later on with other API work in the professional setting as well.

lean dune
#

ill definitely give it a try! but i really dont know where to start

limber gulch
lean dune
#

alright! ill give it some thought for sure lmfao, if i ever have some free time ill definitely try it out

limber gulch
lean dune
#

okay! thankyou

limber gulch
lean dune
#

ill take a look for sure!

limber gulch
lean dune
#

alright lmfao, if i ever have some freetime ill try learning it!

limber gulch
#

😺

lean dune
#

defowler is it possible to have a timer for warps?

#

that might be too much to ask, if it is thats fine lmfao no need to do it ofc

azure osprey
#

Yes it's possible

#

Also I cannot find this error with the transfer money

lean dune
#

hmmm

#

maybe it works? have you tried it?

azure osprey
#

All other button functions work normally but that

#

Yes

tribal wyvernBOT
#
Program Output
(node:22) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use ​`node --trace-warnings ...​` to show where the warning was created)
/home/jail/prog.js:1
import {
^^^^^^

SyntaxError: Cannot use impor
unreal knollBOT
#
Debug Result

There are 4 errors in this [code](#1100963388173070358 message):

main.js:30:25 - error TS2339: Property 'player' does not exist on type 'BeforeItemUseEvent'.

30     const player = data.player;
                           ~~~~~~
main.js:111:9 - error TS2304: Cannot find name 'discordCode'.

111         discordCode.title("§l§9- Codes -§r");
            ~~~~~~~~~~~
main.js:112:9 - error TS2304: Cannot find name 'discordCode'.

112         discordCode.textField('§l§dDiscord Join Code§f: §9rMqcCGMQhv\n\n§l§9Enter Discord Code Below',
            ~~~~~~~~~~~
main.js:114:9 - error TS2304: Cannot find name 'discordCode'.

114         discordCode.show(player).then((r) => {
            ~~~~~~~~~~~

lean dune
#

i think i know the issue

azure osprey
#

What is it!

lean dune
#

i dont think the issue is with the GUI

#

i think the issue is with my add-on!

#

instead of trying to remove their money with scoreboard commands or add their money with scoreboard commans try ths

#

this

#

/tag add @initiator "money:500" that would be to add the money

#

to remove its like this

#

/tag add @initiator "money:-500"

#

or whatever @ you would use

azure osprey
#

${selectedPlayer}?

lean dune
#

Idk, however you would add the money

#

Ik for me in game if I want to add money to myself it’s

azure osprey
#

There's a addScore function

lean dune
#

/tag add @s “money:amount”

azure osprey
#

Use it?

lean dune
#

Well to add money using the add-on I use you can test if they have enough money using scoreboard

#

But can not remove it, rather remove it using /tag add @s “money-500”

#

“money:-500”*

#

So to test their money you would still do /scoreboard players test @s money then the amount

#

But to remove such money you would use the tag

#

Does that make sense?

azure osprey
#

Ok. I have come to the conclusion that the error is not an actual error: it's a bug, I remove the transfer money from the script and the error is still here!

lean dune
#

hmmm

azure osprey
#

Otherwise I'm just bad

lean dune
#

does it say where the error is?

azure osprey
#

Yes I will go grab it

lean dune
#

alright!

#

the problem right now is that money transfer wont open correct?

azure osprey
#

[Blocks][error]-failed to read file data

[Blocks][error]-failed to read file data

[Scripting][error]-TypeError: Unexpected type passed to function argument [0]. at home (main.js:44)
at <anonymous> (main.js:32)

lean dune
#

so moneytransfer just wont open at all?

azure osprey
#

Correct! Also the error pops up upon opening the home form

#

Also the line numbers are incorrect

lean dune
#

you wanna try to call upon alec?

#

the other guy in here

azure osprey
#

Absolutely

#

Otherwise a professional

lean dune
#

alright well he just got online so maybe he sees our messages

#

@limber gulch may we please use your help

limber gulch
#

Hi.

lean dune
#

so we have an error in the code i believe and we dont know how to fix it

limber gulch
#

Which file is it? The “main.js” above?

lean dune
#

@azure osprey thats all him to be honest

limber gulch
#

Or Template_GUI…

lean dune
#

its in template GUI

#

thats the pack entirely

limber gulch
#

The BeforeItemUse error is probably something related to the 1.19.80 changes, and I’m not fully up to speed on those related changes

#

The discordCode error

lean dune
#

hmm, is there a way to know what changed

limber gulch
#

There’s a function “discordCode”

lean dune
#

like what to change in the code because of the update

limber gulch
#

And a variable “DiscordCode”

lean dune
#

yeah

limber gulch
#

The wrong name was used for the variable I think

lean dune
#

hm, so what would @azure osprey do

azure osprey
#

I personally would delete the whole file and redo all of it

lean dune
#

what...

#

like...?

#

redo everything...

azure osprey
#

Yes

lean dune
#

i didnt make this, i dont know ho to code

azure osprey
#

Ok, How about I remake this whole thing?

lean dune
#

are you sure...?

azure osprey
#

Yes!

lean dune
#

how long would this take?

azure osprey
#

I have the time

lean dune
#

how many days would it take?

azure osprey
#

Maybe 20m to 1h

lean dune
#

oh, thats not too bad actually

#

alright, im fine with it. i mean thankyou a lot. just remember the tag stuff for money transfer

#

and coordinates for warp and all that

azure osprey
#

Here, Send me your world so all stuff can be reused

lean dune
#

alright!

#

ill message you it

limber gulch
azure osprey
#

I wouldn't call it solid

limber gulch
#

@lean dune This is how I got started with APIs. I had an addon that I liked. It broke with an update and I got frustrated being stuck and had to learn this stuff so I wouldn’t have to wait on the authors to maybe get around to re-publishing.

lean dune
#

thats cool!

#

i have a quesion alec, do you know a way that without using @p do a command for someone if they did something but they didnt "initiate" the command

#

so not @initiator either

limber gulch
#

Please clarify

#

So the executor of the command can be set by “execute as”

lean dune
#

so to be specific i have a npc, i want to use it as a shop command. so right now i have it setblock next to a command block as a redstone block to activate the command. but i have no way to test them without using @p since they didnt initiate the command, the npc did

azure osprey
#

Why not chat commands?

#

Like DLL.myCmd

lean dune
#

chat commands?

azure osprey
#

Yes

lean dune
#

what are these? like script like what we are doing for the GUI

azure osprey
#

Also use them with the gui

#

Here: I will supply one

lean dune
#

amazing idea. but the time that would take would be sickening

azure osprey
#

I already have one

limber gulch
#

Commands and command blocks can be squirrelly, since you have very limited functionality and have to get creative to find a solution.

lean dune
#

hmmm

limber gulch
#

You’ll like the API solution better

azure osprey
#

That's where JavaScript comes in

lean dune
#

oh jeex

#

everything to goes to java at some point

limber gulch
#

Easy way to learn is to get something that works to start with

lean dune
#

because my shops are huge

#

like there are over 50+ things that you can buy

#

and will be able to sell

limber gulch
#

And when something breaks it in a minor update, read the changelogs and try to fix

lean dune
#

ahhh

#

but i have so many things to buy/sell

limber gulch
#

Javascript handles that sort of thing very well

lean dune
#

but thats a lot of coding

limber gulch
#

The code could be simple enough and the bulk of it would be data entry for the items and associated values

#

And if you set it up carefully, you can keep your files neat and readable

lean dune
#

hmmm... i guess its all up to @azure osprey i feel like if we did have that it kind of would help my realm stand out from others, because no other realm has a virtual buy/sell

limber gulch
#

Look at the import/export stuff in the first Javascript manual I sent

#

You’ll be able to have all your items and values in a separate file

lean dune
#

alriggt

limber gulch
#

And be able to import them into your main shop code

azure osprey
#

So, We making a custom cmd?

lean dune
#

a custom cmnd?

azure osprey
#

Custom command builder: DLL.sell iron 28

lean dune
#

couldnt we just have it in the UI?

azure osprey
#

DLL.gui

#

Yes

lean dune
#

like right click the UI, then click shop, sell, the type of item, so if its wheat then farming

#

then select the amount, sell

#

is that possible?

azure osprey
#

Right clicking, No

lean dune
#

well interact

#

just like the GUI does now

#

to access it, i have to right click

#

or "interact"

azure osprey
#

How about I send a basic server script pack containing cmd builders, gui

lean dune
#

sure! ill go on a test world and see what your proposing

azure osprey
#

So, first lets make the cmd builder!

lean dune
#

okay, whats that exactly?

#

just so ik what we are doing

azure osprey
#

Here:

import {
    world,
    Player,
    system
} from '@minecraft/server';
const config = {
    prefix: 'DLL.';
}
class commandBuilder {
    constructor() {
        this.registeredCommands = [];
    }
    create(info, callback) {
        this.registeredCommands.push({
            name: info.name.toLowerCase().split(' ')[0],
            description: info.description ?? undefined,
            usage: info.usage,
            permission: info.permission,
            callback
        });
    }
    remove(command) {
        const index = this.registeredCommands.findIndex(cmd => cmd.name === command);
        if (index !== -1) {
            this.registeredCommands.splice(index, 1);
        }
    }
    forEach(callback, thisArg) {
        this.registeredCommands.forEach(callback, thisArg);
    }
    clear() {
        this.registeredCommands = [];
    }
};
const command = new commandBuilder();

world.events.beforeChat.subscribe((data) => {
    try {
        const {
            message,
            sender: player
        } = data;
        if (!message.startsWith(config.prefix)) return;
        const args = message.trim().toLowerCase().slice(config.prefix.length).split(/\s+/g);
        const cmd = args.shift()
        const cmdData = command.registeredCommands.find(c => c.name === cmd);
        data.cancel = true;
        if (!cmdData) return player.sendMessage(`§cInvalid command! The command '${cmd}' does not exist.`);
        if (cmdData.permission && !cmdData.permission(player)) return player.sendMessage(`§cInvalid permission! You do not have permission to execute the '${cmd}' command.`);
        cmdData.callback({
            player,
            args
        })
    } catch (error) {
        console.error(error);
        command.clear();
    }
});
lean dune
#

whats this

azure osprey
#

Cmb builder!

lean dune
#

oh! so what does it do exactly

#

and how do i start using it

azure osprey
#
const gui {
    main: ((player) => {})
};

command.create({
    name: 'gui',
    description: ''
}, ({
        player,
        args
    }) => {});
lean dune
#

this is a part of the other one?

azure osprey
#

This is the command creator/regester

lean dune
#

alright

azure osprey
#
command.create({
    name: 'gui',
    description: ''
}, ({
        player,
        args
    }) => {
//Your everyday code here!
});
lean dune
#

so are you just kind of dumping all the code your making for it here?

azure osprey
#

Yes

lean dune
#

alright!

azure osprey
#

Oh no it's 1:34!

lean dune
#

huh?

azure osprey
#

Its past my sleep schedule

lean dune
#

oh!

azure osprey
#

Ok, Last questions?

lean dune
#

yes! do you have the script with the moneytransfer fixed?

#

or are we still fixing that?

azure osprey
#

No ]:

#

That's why we rebuild it!

lean dune
#

yeah! alright, and are we building the shop into the GUI?

#

like the buy/sell for everything

azure osprey
#

Ok, We first need our: waitMove function as the player may still be in the chat, The rest of the code will be executed after the player has moved

lean dune
#

okay, so we will be having a buy/sell shop in the GUI

azure osprey
#

Definitely

lean dune
#

okay! well thankyou again! do you know when youll be back your time?

azure osprey
#

Yes, Around 10:00AM

lean dune
#

so my time, idk lmfao

azure osprey
#

What time zone?

lean dune
#

im central

#

8pm?

azure osprey
#

Possibly

#

Well, Ping me when it's time!

lean dune
#

its 11am for me right now so i think so

#

okay, i will aroud 8pm then!

azure osprey
#

Example: @azure osprey get online

lean dune
#

yeah lmfao

#

well thankyou again!

azure osprey
lean dune
#

alright

lean dune
#

i have an idea! chest UI! ill tell you ab it when your awake

minor ginkgo
#

This stopped working. Ive already changed the manifest to reflect the update. Now im teying to find all the changes i need to make. This isnt worki g now.

import { world } from "@minecraft/server"

world.events.projectileHit.subscribe(eventData => {
  const {
    source,
    projectile,
    blockHit
  } = eventData

  if (!source.hasTag("gamer")) return;

  if (!blockHit) return;

  const { block } = blockHit

  let power = block.getRedstonePower()

  if (power >= 14) return;

  // code here when player has tag and power is 14
  {
    source.runCommandAsync(`function getkey`)
  }
})```
lean dune
#

we dont know man, only the manifest

#

make a post ab it

unreal knollBOT
#
Debug Result

There is 1 error in this [code](#1100963388173070358 message):

<repl>.js:7:5 - error TS2339: Property 'blockHit' does not exist on type 'ProjectileHitEvent'.

7     blockHit
      ~~~~~~~~

warm oar
#
let a: ProjectileHitEvent;

a.getBlockHit()
unreal knollBOT
#
No Errors

No errors in [code](#1100963388173070358 message)

minor ginkgo
#

Do I add that and remove the blockhit from the const?

warm oar
#

yes

#

do const blockHit = eventData.getBlockHit()

minor ginkgo
#
import { world } from "@minecraft/server"

world.events.projectileHit.subscribe(eventData => {
  const blockHit  = eventDatagetBlockHit()
  if (!source.hasTag("gamer")) return;
  if (!blockHit) return;
  const { block } = blockHit
  let power = block.getRedstonePower()
  if (power >= 14) return;
  // code here when player has tag and power is 14
  {
source.runCommandAsync(`function getkey`)
  }
})```
warm oar
#

wjy u removes all

#

only blockHit required change

minor ginkgo
#
import { world } from "@minecraft/server"
world.events.projectileHit.subscribe(eventData => {
  const {
    source,
    projectile,
    blockHit
  } = eventData
  if (!source.hasTag("gamer")) return;
  if (!blockHit) return;
  const blockHit = eventData.getblockHit
  let power = block.getRedstonePower()
  if (power >= 14) return;
  // code here when player has tag and power is 14
  { 
source.runCommandAsync(`function getkey`)
  }
})```
warm oar
#

u didnt removed block hit on top

#
import { world } from "@minecraft/server"
world.events.projectileHit.subscribe(eventData => {
  const {
    source,
    projectile
 
  } = eventData
  if (!source.hasTag("gamer")) return;

const blockHit = eventData.getblockHit

  if (!blockHit) return;
  
  let power = block.getRedstonePower()
  if (power >= 14) return;
  // code here when player has tag and power is 14
  { 
source.runCommandAsync(`function getkey`)
  }
})```
minor ginkgo
#

What about the first part
let a: ProjectileHitEvent;
......

warm oar
#

eventData is of that class type
to make bot work i used that

#

so a becomes eventData

minor ginkgo
#

OK. Thanks. I'm gonna test it out.

minor ginkgo
#

still doesn't work. Where can I find the changes. Could it be the source?

warm oar
#

the error was just about block Hit

unreal knollBOT
#
Debug Result

There are 2 errors in this [code](#1100963388173070358 message):

<repl>.js:10:28 - error TS2551: Property 'getblockHit' does not exist on type 'ProjectileHitEvent'. Did you mean 'getBlockHit'?

10 const blockHit = eventData.getblockHit
                              ~~~~~~~~~~~

  @minecraft/server.d.ts:15590:5
    15590     getBlockHit(): BlockHitInformation | undefined;
              ~~~~~~~~~~~
    'getBlockHit' is declared here.
<repl>.js:14:15 - error TS2304: Cannot find name 'block'.

14   let power = block.getRedstonePower()
                 ~~~~~

warm oar
#

oh i forgot to ()

minor ginkgo
#

Should it be

 eventData.getBlockHit()```
empty shore
#

how did this end up to 300 comments