Help with Rolling Mechanic

  1. What do you want to achieve?
    I want to allow the player to roll backwards like in demon slayer games where they can roll backwards.

  2. What is the issue?
    The keys needed to roll backwards are the S key and the E key. Whenever you press the S key it makes the player rotate so the backflip doesn’t work.

The Problem:
ezgif-2-bd6e94c6df48

What I Want to Happen:
ezgif-2-a358ac72cd04

The problem fixes when shift lock is turned on but i don’t want the player to always have shift lock on.

  1. What solutions have you tried so far?
    I have tried to turn off humanoid.AutoRotate but it doesn’t seem to help. I tried looking for a solution but I couldn’t find any.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

----Services and Other Variables-----
local UIS = game:GetService("UserInputService")
local char = script.Parent
local particleE = game.ReplicatedStorage:WaitForChild("Particles")
local StopE = game.ReplicatedStorage:WaitForChild("StopParticles")
----Animations-----
local Rollanim = Instance.new("Animation")
Rollanim.AnimationId = "rbxassetid://6869466863"
local Flipanim = Instance.new("Animation")
Flipanim.AnimationId = "rbxassetid://6881270464"


----KeyBinds-----
local Ekey = Enum.KeyCode.E
local QKey = Enum.KeyCode.Q
local Wkey = Enum.KeyCode.W
local Akey = Enum.KeyCode.A
local Skey = Enum.KeyCode.S
local Dkey = Enum.KeyCode.D

local canRoll = true


UIS.InputBegan:Connect(function (input, GPE)
	if GPE then return end
	if not canRoll then return end

	if input.KeyCode == Ekey then
		canRoll = false

		local playAnim = char.Humanoid:LoadAnimation(Rollanim)
		playAnim:Play()

		local trail = char.Head.Parent:WaitForChild("Trail")
	
		local trail2 = char.Head.Parent:WaitForChild("Trail2")
		
		local cloud = char.HumanoidRootPart:WaitForChild("TrailAttatchment5")
		particleE:FireServer(trail,trail2,cloud)

		local slide = Instance.new("BodyVelocity",char.HumanoidRootPart)
		slide.MaxForce = Vector3.new(1,0,1) * 30000
		slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100

		for count = 1,6 do
			wait(0.1)
			slide.Velocity *=0.7
		end
		StopE:FireServer(trail,trail2,cloud)
		

		playAnim:Stop()
		slide:Destroy()
		canRoll = true
	end

end)





UIS.InputBegan:Connect(function (input, GPE)
	if GPE then return end
	if not canRoll then return end

	if (input.KeyCode == Ekey and UIS:IsKeyDown(Skey)) or (input.KeyCode == Skey and UIS:IsKeyDown(Ekey)) then 
		canRoll = false

		local playAnim2 = char.Humanoid:LoadAnimation(Flipanim)
		playAnim2:Play()

		local trail = char.Head.Parent:WaitForChild("Trail")
		--trail.Enabled = true
		local trail2 = char.Head.Parent:WaitForChild("Trail2")
		--trail2.Enabled = true
		local cloud = char.HumanoidRootPart:WaitForChild("TrailAttatchment5")
		particleE:FireServer(trail,trail2,cloud)

		local slide = Instance.new("BodyVelocity",char.HumanoidRootPart)
		slide.MaxForce = Vector3.new(1,0,1) * 30000
		slide.Velocity = char.HumanoidRootPart.CFrame.LookVector * -100

		for count = 1,6 do
			wait(0.1)
			slide.Velocity *=0.7
		end
		StopE:FireServer(trail,trail2,cloud)
		

		playAnim2:Stop()
		slide:Destroy()
		canRoll = true
	end

end)

Hello! I think i fixed it.

----Services and Other Variables-----
local UIS = game:GetService("UserInputService")
local char = script.Parent
----Animations-----
local Rollanim = Instance.new("Animation")
Rollanim.AnimationId = "rbxassetid://6869466863"
local Flipanim = Instance.new("Animation")
Flipanim.AnimationId = "rbxassetid://6881270464"


----KeyBinds-----
local Ekey = Enum.KeyCode.E
local QKey = Enum.KeyCode.Q
local Wkey = Enum.KeyCode.W
local Akey = Enum.KeyCode.A
local Skey = Enum.KeyCode.S
local Dkey = Enum.KeyCode.D

local canRoll = true


UIS.InputBegan:Connect(function (input, GPE)
	if GPE then return end
	if not canRoll then return end

	if input.KeyCode == Ekey then
		canRoll = false
		char.Humanoid.AutoRotate = false

		local playAnim = char.Humanoid:LoadAnimation(Rollanim)
		playAnim:Play()




		local slide = Instance.new("BodyVelocity",char.HumanoidRootPart)
		slide.MaxForce = Vector3.new(1,0,1) * 30000
		slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100

		for count = 1,6 do
			wait(0.1)
			slide.Velocity *=0.7
		end


		playAnim:Stop()
		slide:Destroy()
		char.Humanoid.AutoRotate = true

		canRoll = true
	end

end)





UIS.InputBegan:Connect(function (input, GPE)
	if GPE then return end
	if not canRoll then return end

	if (input.KeyCode == Ekey and UIS:IsKeyDown(Skey)) or (input.KeyCode == Skey and UIS:IsKeyDown(Ekey)) then 
		canRoll = false
		char.Humanoid.AutoRotate = false

		local playAnim2 = char.Humanoid:LoadAnimation(Flipanim)
		playAnim2:Play()

		local slide = Instance.new("BodyVelocity",char.HumanoidRootPart)
		slide.MaxForce = Vector3.new(1,0,1) * 30000
		slide.Velocity = char.HumanoidRootPart.CFrame.LookVector * -100

		for count = 1,6 do
			wait(0.1)
			slide.Velocity *=0.7
		end


		playAnim2:Stop()
		slide:Destroy()
		char.Humanoid.AutoRotate = true

		canRoll = true
	end

end)

You have maybe disabled the autorotate after the animation plays.

I suggest you to change a bit this system, it could be better if when you press either W,A,S,D while the E key is being held and then you dash depending on the key. This dash system i’m suggesting you is like the one in Dragon Ball Final Stand.

So the Ekey has to be held first? Then the W, A, S, or D keys?

Yes, it’s just a suggestion that feels more comfortable (this suggestion it’s not added to the code i sent you)