ALREADY SOLVED
i want make a roll script like in darksouls like this
i try to make a script but inst working, someone can help me? (also if you wanna test in studio the animation its just for test)
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://1258941951"
local Dash = Humanoid:LoadAnimation(Anim)
local Properties = {
Velocity = 50,
Duration = 1,
Keybind = Enum.KeyCode.Backspace,
LastDash = tick(),
Cooldown = 2,
}
UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if Input.KeyCode == Properties.Keybind then
if tick() - Properties.LastDash >= Properties.Cooldown then
Properties.LastDash = tick()
Dash:Play()
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(1,1,1) * 500000
BodyVelocity.Velocity = Character.HumanoidRootPart.CFrame.LookVector * Properties.Velocity
BodyVelocity.Parent = Character.HumanoidRootPart
wait(Properties.Duration)
BodyVelocity:Destroy()
end
end
end)