How to change players knockback

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

EcseBecse

Member
Sep 15, 2022
1
0
1
24
Hi i am creating a combofly server and i want a nice kb i have nohitdelay rn and i want to do that when i hit someone and he goes on air he doesnt goes too far and i can hit again so when i combo someone up he does not falls because i can hit him because he doesnt flys too far in sky. I have no idea how to limit the vertical knockback so please if someone has an idea how to skript it please help. Also i tried knockbackpatch but it is buggy and i cant change the knockback its always 0.
 
In an on damage event, you could wait 1 tick and change the y-component of player's velocity. Essentially, this would limit their vertical velocity to whatever you want to set it to. e.g.:
Code:
on damage:
  wait 1 tick
  set y-component of player's velocity to min(y-component of player's velocity, 5)
This would set the player's vertical velocity to whichever's smallest; their y velocity or the number 5.
In regards to changing the knockback specifically, that's unfortunately a bit more tricky and depends on what server type you're using. If you're using paper or spigot though, I know they don't have a specific "set knockback" method for knockback events, so you'd need to find another way to do so.