Trying to change the body velocity of a player after pressing a certain key?
I'm trying to change the body velocity of the player after they press a certain key. Ideally, I wanted it so after the player pressed a certain key they world be flung upwards and then flung downwards back to the ground. Here is my failed attempt.
02 | local UIS = game:GetService( "UserInputService" ) |
03 | local char = script.Parent |
04 | local jumpshiftanim = Instance.new( "Animation" ) |
07 | local keybind = Enum.KeyCode.LeftShift |
10 | UIS.InputBegan:Connect( function (input,gameprocessed) |
11 | if gameprocessed then return end |
12 | if not canjump then return end |
14 | if input.KeyCode = = keybind then |
17 | local playAnim = char.Humanoid:LoadAnimation(jumpshiftanim) |
20 | local jump = Instance.new( "BodyVelocity" ) |
21 | local jump 2 = Instance.new( "BodyVelocity" ) |
22 | jump.Velocity = Vector 3. new( 0 , 50 , 0 ) |
23 | jump.Parent = char.HumanoidRootPart |
25 | jump 2. Velocity = Vector 3. new( 0 ,- 700 , 0 ) |
26 | jump 2. Parent = char.HumanoidRootPart |