Help with making a precise teleport system

Started by Screech on

Topic category: Troubleshooting, bugs, and solutions

Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with making a precise teleport system

So I'm trying to make a teleportation system that works like this:

You open a GUI by pressing a keybind

The GUI has a few elements:

  • X Coordinate input window
     
  • Y Coordinate input window
     
  • Z Coordinate input window
     
  • "Travel" button that teleports you to the coordinates you picked previously.
     

I have attempted this many times previously using a few methods with variables however this never seems to work and the game keeps crashing when I open the GUI.

Has anyone ever made such a thing and managed to make it functional?

Please help me. 

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This could probably work-…
Sat, 12/03/2022 - 18:54

This could probably work- the tricky part would be translating the selected coordinates into a command. You might also just want to get rid of the y coordinate and replace it with 'world height at x, z,' otherwise it'll be really easy to teleport underground or into the sky. 

My recommendation would be to create custom, player-persistent number variables for your coordinates, (x location, z location, etc), that update whenever the player enters new numbers into the GUI. Then, when they push the travel button, have a procedure that teleports them to the selected variables as the coordinates.