Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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

Ad
Log in to vote
0
Answered by 6 years ago

I find out the problem, i would explain but this link does it better.

https://scriptinghelpers.org/questions/35035/surface-gui-cant-be-clicked

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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()

Answer this question