How to do movement animations?

I have a question about animations. I have a fighting game and I think the best way or at least decided the best way for me to do animations for fighters is this however I don’t know how to get movement animations to work as I usually just take the animate script from the character and change the values to my animations.

Template - Roblox Studio 8_25_2020 6_52_43 PM (2)

The template script is all just user input and then obviously whenever the player hits the E key or R key or whatever I’ll just play the animation, but idle and walk animations are different

local blocking = false
local crouhcing = false

local debounces = {}

UIS.InputBegan:Connect(function(Input, Game)
	if Game then return end
	if Input.KeyCode == Enum.KeyCode.W then
		print("Walk")
	elseif Input.KeyCode == Enum.KeyCode.LeftControl then
		print("Crouch")
		crouhcing = true
	elseif Input.KeyCode == Enum.KeyCode.LeftAlt then
		print("Block")
		blocking = true
	elseif Input.KeyCode == Enum.KeyCode.LeftControl and blocking == true then
		print("Crouch + Block")
	elseif Input.KeyCode == Enum.KeyCode.LeftAlt and crouhcing == true then
		print("Block + Crouch")
	elseif Input.KeyCode == Enum.KeyCode.E and not debounces[Input.KeyCode] then
		wait(0.5)
		debounces[Input.KeyCode] = false
	elseif Input.KeyCode == Enum.KeyCode.R and not debounces[Input.KeyCode] then
		wait(0.5)
		debounces[Input.KeyCode] = false
	elseif Input.KeyCode == Enum.KeyCode.F and not debounces[Input.KeyCode] then
		wait(0.5)
		debounces[Input.KeyCode] = false		
	end
end)

UIS.InputEnded:Connect(function(Input, Game)
	if Input.KeyCode == Enum.KeyCode.W then
		print("Stop Walk")
	elseif Input.KeyCode == Enum.KeyCode.LeftControl then
		print("Stop Crouching")
		crouhcing = false
	elseif Input.KeyCode == Enum.KeyCode.LeftAlt then
		print("Stop Blocking")
		blocking = false
	end	
end)
1 Like

The very first thing you want to do if your rewriting the entirety of animation is to make your script called Animation so it overrides the default animation script and they don’t collide (break), and then from there you need to learn how to script animation and what animation priority is to make them from that folder.
Very poor example of coding a animation below:

local Humanoid = script.Parent.Humanoid
local Animation = Folder.Animation1
local AnimTrack = Humanoid:LoadAnimation(Animation) -- this is what you will be playing and stopping not the animation
function walking()
AnimTrack:Play()
end
function stopwalking()
AnimTrack:Stop()
end
2 Likes