Canceling movement but not gravity

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Famix

New Member
Jun 6, 2019
9
0
1
23
Hello, my skript:

Code:
on any movement:
 if {nomove.%player%} is set:
  cancel event

but i want them to have gravity, and i don't know how to do that
 
Last edited:
Hey Famix,

Here is how you would do this:
Code:
on any movement:
  if {nomove.%player%} is set:
    set {_l} to player's location
    set {_l}'s x-coordinate to {-lastPos::%player%}'s x-coordinate
    set {_l}'s z-coordinate to {-lastPos::%player%}'s z-coordinate
    teleport player to {_l}
  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!
 
Status
Not open for further replies.