#how I add a velocity/vector in custom block/stair

1 messages · Page 1 of 1 (latest)

shadow vapor
#

Self-Explanatory and how I do that? I don't sure if the vector is the location and I want teleport in that location or the velocity is teleport in specific location?

shadow vapor
#

how I add a velocity/vector in custom block/stair

shadow vapor
#

This is my code

import { Block, Player, system, Vector, world } from "@minecraft/server"

world.afterEvents.blockPlace.subscribe((data) => {
  system.run(() => {
    const block = data.block
    const player = data.player
    if (block.typeId == "stair:custom_stairs") {
      block.isWaterlogged = true
      const first_coordinate = player.teleport({
        x: player.location.x = -0.22,
        y: player.location.y = 1,
        z: player.location.z
      });
      const second_coordinate = player.teleport({
        x: player.location.x,
        y: player.location.y,
        z: player.location.z = 1
      });
      if (player.location(${ first_coordinate })) {
        player.runCommand(`tp ~-0.22 ~0.5 ~`)
      }
      if (player.location(${ second_coordinate })) {
        player.runCommand(`tp ~ ~ ~1`)
      }
    }
  })
})
proper hawkBOT
#
Debug Result

There are 6 errors in this [code](#1132808859652718613 message):

<repl>.js:19:18 - error TS2349: This expression is not callable.
  Type 'Vector3' has no call signatures.

19       if (player.location(${ first_coordinate })) {
                    ~~~~~~~~

``````ansi
<repl>.js:19:27 - error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.

19       if (player.location(${ first_coordinate })) {
                             ~

``````ansi
<repl>.js:19:28 - error TS1005: ',' expected.

19       if (player.location(${ first_coordinate })) {
                              ~

``````ansi
<repl>.js:22:18 - error TS2349: This expression is not callable.
  Type 'Vector3' has no call signatures.

22       if (player.location(${ second_coordinate })) {
                    ~~~~~~~~

``````ansi
<repl>.js:22:27 - error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.

22       if (player.location(${ second_coordinate })) {
                             ~

``````ansi
<repl>.js:22:28 - error TS1005: ',' expected.

22       if (player.location(${ second_coordinate })) {
                              ~

shadow vapor
#

Help me to fix this script