So I'm very new to scripting, but I am trying to make a roll script where the player does a roll animation and moves forward, when a key is pressed. I got everything working except for the part where the player moves forward, I want it to be a fixed distance so the player can't interrupt it in anyway, and the player should roll in the direction that the player was already moving. So it's basically a Dark Souls roll. It would be amazing if someone could help me.
This is my code:
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=8182577095"
local debounce = false
mouse.KeyDown:connect(function(key)
if key == "q" and not debounce then
debounce = true
local playAnim = humanoid:LoadAnimation(anim)
playAnim:Play()
wait(1)
debounce = false
end
end)

1 comment
Thanks for the help!