How can i make player got pushed?

So , i want to make a script that when a player is hit by one of my power they got pushed in the direction that they got hited and i will add a ragdoll script with that . But idk how to project them in the right direction so if u know help me :smiley:

1 Like

Im assuming you want them to me pushed off a platform or something. You could use forces or simple CFrames. Id use some kind if force parented to them. Let me know if ive misunderstood the question! :slight_smile:

Yea ik how to do that but when i push them with cframe of bodyvelocity it cant be pushed in the direction that they got it . Because i’m using looking vector and if they dont look in the right direction that mess up what i want to make -_-

This post is very vague. What I’m assuming you’re asking for is a script that pushes someone away via magic powers. One way I think of off of the top of my head is that you can do this is by grabbing the LookVector of the magic power that is pushing the targeted player and platformstanding the target, then making a new BodyVelocity instance that pushes the target by the LookVector (multiply it for a stronger push), therefore giving a “push” aspect of the hit.

One thing you could do is get the direction of the force and apply it to the player while also increasing it by the power of the force. What you could do is have a CFrame that has the position of where the power is at, and the next position being the position of the player. Now, you can get the lookvector of it, and multiply it by the power. Now, once you have the direction, you can apply it to the velocity of the character. Here is an example:

function applyforce(character,startpos,goalpos,multiplier) --Function for applying force
local direction = CFrame.new(startpos,endpos).lookVector*multiplier --Get the direction of the force
character.PrimaryPart.Velocity = direction --Apply said force
end
9 Likes