#My Own Custom TPA need help teleport isn't working for global buttons

1 messages · Page 1 of 1 (latest)

weary nacelle
#

everything works except when a player creates a custom single global teleport whenever someone tries to teleport to it nothing happens.. its a long script so i have to attach the file<

#

I am debugging as to why i have this message

#

to make sure the coords were saving and dimension etc

vocal cairnBOT
#
Debug Result

There are 3 errors in this [code](#1096711115053994004 message):

tpa.js:3:20 - error TS2307: Cannot find module './config' or its corresponding type declarations.

3 import config from "./config";
                     ~~~~~~~~~~
tpa.js:9:8 - error TS2307: Cannot find module './db/JsonTagDB.js' or its corresponding type declarations.

9 } from "./db/JsonTagDB.js";
         ~~~~~~~~~~~~~~~~~~~
tpa.js:144:37 - error TS2551: Property 'getDimensionById' does not exist on type 'World'. Did you mean 'getDimension'?

144       const targetDimension = world.getDimensionById(targetTeleport.dimension);
                                        ~~~~~~~~~~~~~~~~

  @minecraft/server.d.ts:13924:5
    13924     getDimension(dimensionId: "overworld" | "nether" | "the end" | "the_end" | "minecraft:overworld" | "minecraft:nether" | "minecraft:the_end"): Dimension;
              ~~~~~~~~~~~~
    'getDimension' is declared here.

wheat lantern
#

Ye, wth is getDimensionById

#

@weary nacelle

weary nacelle
#

awh

#

i will try that

#

using chat gpt lol

#

and its very close but way faster to code

wheat lantern
#

use

player.dimension.id.replace("minecraft:", "")
weary nacelle
wanton tundra
#

y not use the dimension itself...

wheat lantern
weary nacelle
#

awh

weary nacelle
#

work in progress haha

#

just the global is giving me issues

#

Gonna change icons and make it look cleaner

#

later

wheat lantern
#

What is global teleport

weary nacelle
#

the global teleport is the issue im having let me show you. if i create my teleport (if allows one teleport for each player)

wanton tundra
weary nacelle
#

it will populate as players add teleport locations

wheat lantern
#

im confused

wanton tundra
#

that creates public waypoints?

weary nacelle
#

yeah pretty much im just butchering this code tryn to get the telepor to work globaly for all players

weary nacelle
wanton tundra
#

just location and dimension should be enuf

wheat lantern
#

sounds like a sethome

weary nacelle
#

and then i will make a warning and say there is a risk it could be a trap kind thing

weary nacelle
#

but the teleport isn't working so idk

#

its a mess

#

global ones...

wheat lantern
weary nacelle
#

yesssss

#

each player gets one to create

wheat lantern
#

get all players tags and check if global exist then show the button ig

#

Thats what im thinkin'

weary nacelle
#

but i was hoping for players teleports to work if they are offline

#

because it should just be a saved location

wheat lantern
#

Oh okay, save it then

wanton tundra
#

teleport(loc,dim,x,y)

weary nacelle
#

it does i think, but its not calling it properly lol so idk i need to think a little better on what the issue is i hate debugging lol

wanton tundra
#

u forgot x and y

weary nacelle
#

so this is missing the x and y

#

player.teleport(targetTeleport.location, targetDimension);

wanton tundra
#

ye

weary nacelle
#

thanks let me give this a go

wheat lantern
#

player.getRotation().x and player.getRotation.y

weary nacelle
#

awh

wheat lantern
#

So it doesn't teleport player in a straight face

wanton tundra
#

try this one```js
const { warn } = console, { stringify } = JSON;
globalThis.log = async function (data, n = 3) {
if (data instanceof Error) {
const { message, stack } = data
return warn(message, stack)
};
n ? data = stringify(data, 0, n) : null;
warn(data)
}

#

paste it on top of ur main.js or index.js or idk

#

then use it like

log({targetTeleport})
weary nacelle