So my walking animation works in studio but in game, the animation is glitchy.
In Studio:
In Game:
Animate Script: (server script)
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local RunService = game:GetService("RunService")
local runTrack = humanoid:LoadAnimation(script:WaitForChild("Running"))
local walkTrack = humanoid:LoadAnimation(script:WaitForChild("Walking"))
local idleTrack = humanoid:LoadAnimation(script:WaitForChild("Idle"))
local fallTrack = humanoid:LoadAnimation(script:WaitForChild("Fall"))
local jumpTrack = humanoid:LoadAnimation(script:WaitForChild("Jump"))
local function stopAnimations()
for i,v in ipairs(humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
end
humanoid.Running:Connect(function(speed)
if math.floor(speed + 0.5) >= 16 then
stopAnimations()
if not runTrack.IsPlaying then
runTrack:Play()
end
elseif math.floor(speed + 0.5) < 16 and math.floor(speed + 0.5) > 0.75 then
stopAnimations()
if not walkTrack.IsPlaying then
walkTrack:Play()
end
elseif math.floor(speed + 0.5) <= 0.75 then
stopAnimations()
if not idleTrack.IsPlaying then
idleTrack:Play()
end
end
end)
humanoid.FreeFalling:Connect(function(isActive)
if isActive then
stopAnimations()
if not fallTrack.IsPlaying then
fallTrack:Play()
end
end
end)
humanoid.Jumping:Connect(function(isActive)
if isActive then
stopAnimations()
if not jumpTrack.IsPlaying then
jumpTrack:Play()
end
end
end)