so i made a slide script like sliding on the floor when u press q and it works but i tried to make it so that while ur sliding and u jump u boost forward and jump higher, and that works too but i want it to boost me forward in the direction im looking, how do i do that:
local UIS = game:GetService("UserInputService")
local char = script.Parent
local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = "rbxassetid://106945307699338" -- Enter your AnimtionID
local keybind = Enum.KeyCode.Q -- between the key for ability
local canslide = true
local jumpthing = false
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if jumpthing == true then
if input.KeyCode == Enum.KeyCode.Space then
local humanoid = char:WaitForChild("Humanoid")
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
char.HumanoidRootPart.Velocity = char.HumanoidRootPart.Velocity + Vector3.new(0, 50, 250)
end
end
if input.KeyCode == keybind and char:WaitForChild("Humanoid").HipHeight == 2 and canslide then
canslide = false
jumpthing = true
local playAnim = char.Humanoid:LoadAnimation(slideAnim)
playAnim.Priority = Enum.AnimationPriority.Action -- Set priority to Action
playAnim:Play()
local slide = Instance.new("BodyVelocity")
slide.MaxForce = Vector3.new(1,0,1) * 30000
char.Humanoid.HipHeight = 1
slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100
slide.Parent = char.HumanoidRootPart
for count = 1, 8 do
wait(0.1)
slide.Velocity*= 0.7
end
playAnim:Stop()
slide:Destroy()
char.Humanoid.HipHeight = 2
jumpthing = false
task.wait(3)
canslide = true
end
end)