Idle/Walk Animation system

Idle/Walk Animation system

by D_rawest15

Author Avatar

In this toutorial i will teach you how to make an Idle/Walk Animation system because i noticed that there arnt many toutorials on youtube or just searching on roblox on how to do it

Step # 1

you will need a local script

     ** why not on server? **

because server is slow to react with movements like this


-- // ANIMATIONS -- \\

local idle = Instance.new("Animation")
idle.AnimationId = -- your animationId
local walk = Instance.new("Animation")
walk.AnimationId = -- your animationId
--____________________________________________________

You have 1 of 2 choices next for which check mvoement You can either use the function Humanoid.Running or Humanoid:GetPropertyChangedSignal("MoveDirection")

but for this i will be using the first one

Step # 2

local player = game.Players.LocalPlayer

-- // MAKING A FUNCTION WHEN CHARACTER IS ADDED \\ --
function CharAdded(char)
    local hum = char:WaitForChild("Humanoid")
    local Idle_Track = hum:LoadAnimation(idle)
    local Walk_Track = hum:LoadAnimation(walk)

    -- // RUNNING FUNCTION \\ --
    hum.Running:Connect(function(speed)
        if speed == 0 then -- this is for if you are idle
            Walk_Track:Stop() -- stopping walk track
            Idle_Track:Play() -- playing idle track
        else
            Idle:Track:Stop() -- stopping idle track
            Walk_Track:Play() -- playing walk track
        end
    end)
end

Step # 3

-- // CONNECTING THE FUNCTIONS \\ --
player.CharacterAdded:Connect(CharAdded)

if player.Character then -- checking if character already exists
    CharAdded(player.Character)
end

hope yall understand this toutorial i had a lot of trouble when i was starting out finding how to do this :P