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.

Canceling movement but not gravity

Discussion in 'Skript' started by Famix, Aug 5, 2020.

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

    Famix New Member

    Joined:
    Jun 6, 2019
    Messages:
    9
    Likes Received:
    0
    Hello, my skript:

    Code (Text):
    1. on any movement:
    2.  if {nomove.%player%} is set:
    3.   cancel event
    but i want them to have gravity, and i don't know how to do that
     
    #1 Famix, Aug 5, 2020
    Last edited: Aug 5, 2020
  2. SkriptLearner

    SkriptLearner Member

    Joined:
    Jul 21, 2019
    Messages:
    45
    Likes Received:
    0
    Hey Famix,

    Here is how you would do this:
    Code (Text):
    1. on any movement:
    2.   if {nomove.%player%} is set:
    3.     set {_l} to player's location
    4.     set {_l}'s x-coordinate to {-lastPos::%player%}'s x-coordinate
    5.     set {_l}'s z-coordinate to {-lastPos::%player%}'s z-coordinate
    6.     teleport player to {_l}
    7.   set {-lastPos::%player%} to player's location
    As you can see here, instead of cancelling the event, I set their x and z coordinate to the location but keep their new y coordinate therefore allowing y movement.

    I hope this helps!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...