So i'm working on a Punch script, and I wanted to script it that if a Player is punched, the Player goes flying backwards with force. How would I do that?
Call the flyback function, and provide the character that you want to make fly backwards Variables can be adjusted for higher/longer flight, and so it flings backwards harder.
function flyback(char) local back=Instance.new("BodyForce",char.Torso) local up=Instance.new("BodyForce",char.Torso) up.Force=Vector3.new(0,5000,0) back.Force=char.Torso.CFrame.lookVector*-3000 wait(1) back:Destroy() up:Destroy() print("Function ran") end wait(2) flyback(script.Parent) print("Called function")
Use a BodyForce. To see more, click here.