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.
adebounce = false
local UIS = game:GetService("UserInputService")
local char = script.Parent
local jumpshiftanim = Instance.new("Animation")
jumpshiftanim.AnimationId = "rbxassetid://example"
local keybind = Enum.KeyCode.LeftShift
local canjump = true
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if not canjump then return end
if input.KeyCode == keybind then
canjump = false
local playAnim = char.Humanoid:LoadAnimation(jumpshiftanim)
playAnim:Play()
local jump = Instance.new("BodyVelocity")
local jump2 = Instance.new("BodyVelocity")
jump.Velocity = Vector3.new(0,50,0)
jump.Parent = char.HumanoidRootPart
adebounce = true
jump2.Velocity = Vector3.new(0,-700,0)
jump2.Parent = char.HumanoidRootPart
for count = 1,8 do
wait(0,1)
end
playAnim:Stop()
jump:Destroy()
wait(6)
jump2:Destroy()
wait(5)
canjump = true
end
end)
