i created a repeating task every second and the task focusing the player on other player(like aimbot) but i have no idea how yaw and pitch works, any ideas?
This question have been answered many times aka. this question is duplicated (example thread). Also if you want the entity to look at player's head then you have to add eye height to Y position.