I make this often however its usually scuffed. I want to make a script where dashing while moving forward, left, right, back and no movement have different dash directions/animations. I just need help with figuring out how to tell which way the character is going. Usually I’d set it up so it recognizes when WASD is pressed (my games for pc only) and then set up priorities for dash directions with if hierarchy. There has to be a more efficient way to do this than checking every input.
Not sure if i understand, do you mean filtering the user input
local inputData = {
[Enum.KeyCode.W] = {
Animation = animation,
Direction = character.HumanoidRootPart.CFrame.LookVector
}
}
UserInputService.InputBegan:Connect(function(input)
local data = inputData[input.KeyCode]
if data then
local animation = data.Animation
local direction = data.Direction
end
end)
Something like this?