I had this function:
Code:
function home(data) {
const player = data.sender;
const msg = data.message.replace("!home", "");
if (!msg) {
player.sendMessage("§cPlease specify a name for the home to teleport.");
return;
}
const homeName = msg.split(" ")[0];
const home = homes.find(element => element.startsWith(`home:${homeName} `));
if (home) {
const [_, x, y, z] = home.split(" ");
player.teleport(new Vector(parseInt(x), parseInt(y), parseInt(z)));
player.sendMessage(`§aTeleported to home: ${homeName}`);
} else {
player.sendMessage(`§cHome "${homeName}" not found`);
}
}
Error:
[Scripting][error]-[Watchdog] 5036.294 ms script hang detected in behavior pack 'SetHome++'
[Scripting][error]-TypeError: Unsupported or out of bounds value passed to function argument [0]. at Vector (native)
at home (home.js:58)
at <anonymous> (home.js:94)