how do i push players back like lbsg when you get too close to the gamemodes i tried knockback($Player,0,0.5,0.5,1) it dont push me back it push somewhere else
You need a point from where you want the player to be pushed away. In this case it seems like you need this point to be in front of the player. You can achieve this by doing the following: PHP: // $p is the Player object$point = $p->getDirectionVector()->add($p);// This is a Vector3 even if only X and Z are needed$force = 0.5;// Or whatever force you like$p->knockBack($p, 0, ($p->x - $point->x), ($p->z - $point->z), $force);//In this case can also be done like that:$direction = $p->getDirectionVector()->multiply(-1);// This is a Vector3 even if only X and Z are needed$force = 0.5;// Or whatever force you like$p->knockBack($p, 0, $direction->x, $direction->z, $force);
You forgot to read the first part: You need a point from where you want the player to be pushed away. If you push away the player from a point in front of himself it actually will be pushed backwards