-
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. -
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:
What I Want to Happen:
The problem fixes when shift lock is turned on but i don’t want the player to always have shift lock on.
-
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)