mojira.dev
BDS-3080

Client Script works but Server Script doesn't

Hello,

I am running a bedrock dedicated server. I am tapping into Scripting API to learn about its possibilities.

I have created an addon which works perfectly fine on the local game copy, but it fails to fully operate on the server. The behaviour is quite strange, so I searched for a resolution but to no avail.

When I say fully, I mean that the Client Script side works fine, but the Server Script side does not respond at all. As if it didn't exist.

I tried a few variants finally resorting to the bare minimum which simply listens for an event and then displays a message in the chat. That didn't work either.

Again, the Client Script works and if I call a chat message in the "minecraft:client_entered_world" event, it shows just fine. 

I have been pulling my hairs out for a few days now trying to find the root of the issue. Then I waved a white flag and came here.

  1. I checked server file permissions to make sure the server can execute all its files.

  2. I tried to run the addon from [server]/behavior_packs, [server]/worlds/[world]/behavior_packs

  3. I experimented with versions and other settings in JSON files e.g. valid_known_packs.json or world_behavior_packs.json

  4. I tried installing the addon manually but also importing the world from the local game copy to the server

  5. I enabled/disable the experimental game mode on the server.

  6. ... and everything in between.

Noting did the trick. Below I attach my code and server details so you can join in and see yourself.

What am I missing?

Addon ZIP

[media]

Server Details

Address: 52.16.178.68

Port: 25655

client.js

const system = client.registerSystem(0, 0);

system.initialize = function() {
this.listenForEvent("minecraft:client_entered_world", (eventData) => this.onStartSetup(eventData));
this.registerEventData("Kox:startSetup", {});
};

system.onStartSetup = function(eventData) {
let playerData = this.createEventData("Kox:startSetup");
playerData.data = eventData.data;
this.broadcastEvent("Kox:startSetup", playerData);
};

server.js

var system = server.registerSystem(0, 0);

system.initialize = function () {
this.listenForEvent("Kox:startSetup", eventData => this.onStartServerSetup(eventData));
};

system.onStartServerSetup = function (eventData) {
let chatEventData = this.createEventData("minecraft:display_chat_event");
chatEventData.data.message = "Yes, I am here!";
this.broadcastEvent("minecraft:display_chat_event", chatEventData);
};

 

 

Attachments

Comments 12

Thank you for your report!
However, this issue is Invalid.

This is a technical support issue; this site is for bug reports only. We do not have the resources to provide you with technical support.
Please contact the community support, linked below.

Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki

Thank you for your report!
However, this issue is Invalid.

This is a technical support issue; this site is for bug reports only. We do not have the resources to provide you with technical support.
Please contact the community support, linked below.

Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki

Thank you for your report!
However, this issue is Invalid.

This is a technical support issue; this site is for bug reports only. We do not have the resources to provide you with technical support.
Please contact the community support, linked below.

Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki

2 more comments

Sorry your bug report has been ignored by the team at Microsoft, Tomasz. You wrote a well-researched bug report.

As far as I can tell from my own testing (a few months ago) client-side scripts work with Bedrock Dedicated Server, but server-side scripts do not. It's not clear to me why this is the case (a bug? or not implemented?). I told myself I'd revisit the issue in 6-12 months and see if Microsoft had made any progress.

I wish you luck in finding a better place than this site to find support. The Discord chat is incomprehensible (to me). The other community forums are almost as bad. I believe, back when I was testing, that Reddit was the best place I could find for intelligible and compassionate support.

Hi Paul,

That's not the case at all, I'm trying to work through 1400 BDS tickets at the moment (and most of us are volunteers) and if this one is a mistake please let me know that I can sort it. I had a watch on this one specifically to keep an eye on any responses.

The issue appeared to me to be a request for help with how to get scripting working (tech support) rather than a bug report. If you believe that's not the case please let me know and I'm happy to get it reviewed.

Ionic

Hi Paul,

That's not the case at all, I'm trying to work through 1400 BDS tickets at the moment (and most of us are volunteers) and if this one is a mistake please let me know that I can sort it. I had a watch on this one specifically to keep an eye on any responses.

The issue appeared to me to be a request for help with how to get scripting working (tech support) rather than a bug report. If you believe that's not the case please let me know and I'm happy to get it reviewed.

Ionic

Hi Paul,

That's not the case at all, I'm trying to work through 1400 BDS tickets at the moment (and most of us are volunteers) and if this one is a mistake please let me know that I can sort it. I had a watch on this one specifically to keep an eye on any responses.

The issue appeared to me to be a request for help with how to get scripting working (tech support) rather than a bug report. If you believe that's not the case please let me know and I'm happy to get it reviewed.

Ionic

There are two key points I'd like to add to this.

First, it is unlikely that this bug would be fixed. The Scripting API has hardly been updated, and given the GameTests that the team has been working on, the Scripting API is mostly useless. Developers from Mojang have also stated during a GameTest Q+A that there would be plans to remove the Scripting API entirely.

Second, relating to the bug report, notice that this report was written for the Linux/Ubuntu distribution of the BDS software. Throughout many tests and discussions, the add-on community noticed that server scripts did in fact work on the Windows distribution of BDS, but did not work on the Linux version. Additionally, as Realms use the Linux version, server scripts did not work on realms either. While it has been marked as Incomplete, the best bug report I can find that mentions this as well is BDS-11490.

migrated

(Unassigned)

Retrieved