Direct X,Y teleportation

So i was just thinking if we could make some code that tracks a players X,Y then when pressing an overlay it stores that players last X,Y value then when the button is pressed again we can use that to teleport a player to the nearest teleporter around that last know X,Y value?


And if so how would we do it?

You cannot teleport a player to a certain x and y. You can add a ton of teleporters but that would be very memory intensive.

1 Like

No, they mean tracking the player’s x, y to teleport to the nearest teleporter…


As for your questions, it is possible…


Use the player coordinates device to monitor the player’s X and Y location. When an overlay button is pressed, trigger a block that saves the current X and Y into variables like lastX and lastY. Then label the teleporters with known coordinates. Then use some logic blocks to find the distance from lastX and lastY to each teleporter. Find out which teleporter is closest by comparing distances and selecting the smallest one. Then, teleport the player.


going offline to eat dinner, bye.
6 Likes

That would still be very memory intensive and complicated. You would need to know the x and y of every teleporter and have a message to send on every channel for each teleporter, along with doing math to find out which is closer.

1 Like

It really depends on how many teleporters you have

1 Like

Ok thanks! Im not big on code but ill figure it out from here!

1 Like

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.