1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to teleport player properly

Discussion in 'Skript' started by FFmax33, Sep 11, 2020.

Thread Status:
Not open for further replies.
  1. FFmax33

    FFmax33 Member

    Joined:
    Sep 1, 2020
    Messages:
    2
    Likes Received:
    0
    Im trying to make a skript that when you right click with a certain item you teleport up 10 blocks, however my current code doesn't take into account your direction. Here is my current code:
    Code (Text):
    1. rightclick with feather:
    2.     if name of tool of player is "Booster":
    3.         set {UniVari} to block 10 above player
    4.         teleport player to {UniVari}
    I have also tried
    Code (Text):
    1. make console execute "/execute as %player% run tp ~ ~10 ~"
    but that tp's you to 10 blocks above consoles location, not players.
    I want this to work without needing essentials.tp or minecraft.command.tp perms
    edit: Doesn't save velocity either (I want it to work with elytra as a way to contiuosly fly close to the ground)
    edit2: MC teleport DOES do these thing but I don't know how to make an item run a command as you without you having perms without using execute
     
    #1 FFmax33, Sep 11, 2020
    Last edited: Sep 11, 2020
  2. Eyst

    Eyst New Member

    Joined:
    Aug 13, 2020
    Messages:
    9
    Likes Received:
    0
    The teleport function works like this:
    Code (Text):
    1. teleport player to location(x, y, z, world "world")
    If you want to change their Y position by 10, set a local variable to their current Y position and add 10 to it.
     
  3. FFmax33

    FFmax33 Member

    Joined:
    Sep 1, 2020
    Messages:
    2
    Likes Received:
    0
    The problem isn't changing their Y position, it is doing that and keeping the players direction and momentum intact
     
  4. Eyst

    Eyst New Member

    Joined:
    Aug 13, 2020
    Messages:
    9
    Likes Received:
    0
    Then you should use the push effect. You can tweak it until you get something you're comfortable with (As far as I have tested, this does keep your momentum intact).
    Code (Text):
    1. push the player upwards at speed 4
     
Thread Status:
Not open for further replies.

Share This Page

Loading...