#scripts not working on servers?

1 messages · Page 1 of 1 (latest)

hot talon
#

import { world } from "@minecraft/server";

world.events.tick.subscribe((data) => {
for(let player of world.getPlayers()){
let nametag = player.getTags().find((tag) => tag.startsWith("nametag:"))
if(nametag){
player.removeTag(nametag)
nametag = nametag.replace("nametag:", "").replaceAll("@s", player.name)
player.nameTag = nametag
}
}
});

#

it works in a world but not server

gusty arch
#

On bds if you wanna use an addon you first need to “install” it on the same world you will use on the server from your client.

hot talon
uneven burrow
hot talon
hot talon
uneven burrow
#

Remove the 3rd dependency, which I'm assuming is the rp

scenic stratus
# gusty arch On bds if you wanna use an addon you first need to “install” it on the same worl...

You can do it that way but you can easily just go into the BDS folder and apply the behavior pack yourself. Put the uncompressed files in development_behavior_packs which should be located at the root directory of your BDS folder. If it doesn't exist then make one. Get the UUID and version number from the manifest of that behavior pack then go to the worlds folder also located at the root of your BDS folder. Go inside the folder for your world then open a file called world_behavior_packs.json. If it doesn't exist then make one. Then using the following format apply the UUID and version for your behavior pack. Restart the BDS server and voila.

world_behavior_packs.json template

[    
        {
        "pack_id": "6169f799-b119-409d-88ca-d9ebc8ef6379",
        "version": [1, 0, 0]
        }
]
#

You also need to make sure that the scripting API is enabled for that world or the scripts will obviously not work.

hot talon
#

like i said it works on worlds and i gave it to friends to try it on other servers to no avial

#

and scripting api is on

scenic stratus
#

That's from your manifest

#

This is what I have in my manifest for those two

            "uuid": "1326c87b-37f3-4543-9f0f-0d03893134e1",
            "version": [0, 0, 1],
hot talon
scenic stratus
#

Hmm disregard, according to the docs the uuid is suppose to be unique. For some reason I was thinking it couldn't be modified but the version does appear to need to be [0, 0, 1]

scenic stratus
hot talon
scenic stratus
#

Hmm, would you be willing to privately send me the pack to test?

hot talon
#

sure

hot talon
#

bisect hosting

hallow hawk
hot talon
scenic tree
#

intresting

#

any guide?

slow glacier
#

My scripts also stopped working. Is there a bug with something to with the dependencies?

#

Because I had the behavior as a resource dependency. I removed it and it stopped working. I tried to add it back and it still won't work.

gusty arch
slow glacier
#

Yep.

gusty arch
#

They changed the name of some functions and events

#

The one that is giving you troubles is probably playerjoin, which you should switch to playerspawn, or idk something else

slow glacier
#

I dont have that anywhere

gusty arch
slow glacier
#

Nothing.

scenic stratus
#

There will be more breaking changes in 1.19.70. So get ready for that lol.

scenic tree
#

xd

slow glacier
#

😡

#

Well. It decided to work. Didn't change a thing.

slender lichen
#

🗿

patent oyster
#

Try using try catch error to get all of the errors

#

?catch

hollow roverBOT
#
Error Handling

With code that is executed synchronously, we can use the try and catch keywords to capture errors:

try {
    // your code here
} catch ( error ) {
    console.warn(  error, error.stack  )
}

This does not work as you expect with asynchronous functions or methods however, as the error does not occur synchronously. We need to utilize the .catch() method of the Promise mechanism to capture errors.

await asyncFunction().catch(e=>console.error(e,e.stack));

//callBack syntax
asyncFunction().then(()=>{
	//callback code
}).catch(e=>console.error(e,e.stack));

About async, aks in #bot-usage ?async

slow glacier
#

Not sure how I was being rude. I merely made a statement that it was working and I didn't do anything, and I don't like the idea of 1.19.70 having more breaking changes. But I know that's what to expect. Whatever.

scenic tree
#

there are bugs wity .70 hope they fix it before release

frigid furnace
scenic tree
#

will they release with bugs ?

slow glacier
#

Not to be rude but....
😡

frigid furnace
scenic tree
#

ye but this one has more issues

#

🥺

slow glacier
#

Omg there is alot to unpack there. I have a question. What is the headLocation? Do you think that will allow us to adjust that. I.e. higher or lower, then would that change the camera view?

scenic tree
#

by default location of player is its foot

#

head location gives u head position instead of foot

#

some factor added to y cord

#

thats it

slow glacier
#

We can't change the head location then huh. I was thinking since when you shrink a players scale, and the camera view doesn't change, the camera could use the player head location. And maybe I could set that to a lower value (I think 1.6 is default) and the camera would lower.

scenic tree
#

yeah

#

i think carera uses foot location and adds to it

#

instead of head location

slow glacier
#

Hmmm. Can that be adjusted?

cedar nexus
#

it depends

#

on bds only

slow glacier
#

Yeah

patent oyster