How can I make a player walk back while looking front and playing an animation?
Well, all my questions I asked was about this, but any of those helped me and I am typing the whole thing I want.
The description of problem is: I made a punching script which a player punches another, punching player walks two studs forward while playing animation. That's okay and done. But target needs to play an animation while walking back after punching. I tried BodyGyro and :MoveTo(), since my characters are R15 it gets crazy while playing animation with BodyGyro.
I tried using RenderStepped event to set CFrame of character to back(0.005 studs every step) and it got crazy by making character teleport upside and back, like player got flung. Currently all I can give here from my code is:
02 | local RS = game:GetService( "RunService" ) |
03 | RS.RenderStepped:connect( function (Step) |
04 | Pl = script.Parent.Parent |
06 | EnemyWrestler = game.Workspace:WaitForChild(Char.Indicator.Value) |
07 | if EnemyWrestler.Unconscious.Value = = true then |
08 | aaa = EnemyWrestler.UpperTorso.Position.Y |
09 | EnemyWrestler.UpperTorso.CFrame = CFrame.new(Vector 3. new(EnemyWrestler.UpperTorso.Position.X, EnemyWrestler.UpperTorso.Position.Y, EnemyWrestler.UpperTorso.Position.Z) + (EnemyWrestler.UpperTorso.CFrame.lookVector)*- 0.005 ) |
10 | EnemyWrestler.UpperTorso.CFrame = CFrame.new(EnemyWrestler.UpperTorso.Position.X,aaa,EnemyWrestler.UpperTorso.Position.Z)*CFrame.Angles(math.rad(EnemyWrestler.UpperTorso.Rotation.X),math.rad(EnemyWrestler.UpperTorso.Rotation.Y),math.rad(EnemyWrestler.UpperTorso.Rotation.Z)) |
I deleted the other one, but other one was like
2 | Humanoid:MoveTo(Vector 3. new(EnemyWrestler.UpperTorso.Position.X, EnemyWrestler.UpperTorso.Position.Y, EnemyWrestler.UpperTorso.Position.Z) + (EnemyWrestler.UpperTorso.CFrame.lookVector)*- 0.005 )) |
If you want to know why player HAVE TO look at front while walking back, it's because animation needs to look realistic. When a person gets punched lightly, it does not spin around it crazy and turn back.