Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a custom animation for walking, swimming, etc. in my game?

So, I made this animation for walking and I got to some walking animation tutorials on yt.

But I know, they wouldn't work.

I know that you have to change the animation in the animate script in the player and making an animate2 script but, it still doesn't work.

Can someone help me please?

3 answers

✓ Accepted answer

You can just make your own AnimationScript. All you have to do is check for changes in the character's humanoid then play the appropriate animation.

-- StarterCharacterScripts-->AnimateScript
local char = script.Parent
local hum = char:WaitForChild("Humanoid")

local runService = game:GetService("RunService")

local anims = char.Animations	 	--Replace with wherever animations are stored
local function animateCharacter()
	if hum.Health <=0 then
		runService:UnbindFromRenderStep("animateCharacter")
	else
		if hum.MoveDirection.magnitude > 0 then
			local cur = hum:LoadAnimation(anims.WalkAnimation)
			cur:Play()
			wait(cur.Length)	--Replace with animations length
		end
	end
end

runService:BindToRenderStep("animateCharacter",0,animateCharacter)

or just play the respective animation for

I am going to assume you're 100% certain that your script is correct, make sure that you're using the compatible model type for your animation. You said "Animate" without displaying any code, so I'm guessing you're using the basic Animation Handler, so make sure you're using the correct one (R15 or R6) , if you are then send some of your code.

However, I would recommend using your own code:

local animTrack = Humanoid:LoadAnimation(animation)
animTrack:Play()

This discussion is preserved as it was. New answers, comments, and votes are closed.