When using the fade time parameter of AnimationTrack:Play(fade, weight, speed), animations that I have imported from Mixamo start T-posing before the actual animation plays when the fade time is above 0.1. But, if I set it to 0.1 or 0, the animation snaps and does not look smooth.
-- Players
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
-- Anims
local Idle = script.Idle
local Walk = script.Walk
local Run = script.Run
-- table
local animtable = {
animator:LoadAnimation(Idle),
animator:LoadAnimation(Walk),
animator:LoadAnimation(Run)
}
humanoid.Running:Connect(function(speed)
if speed < 1 then
for i, v in ipairs(animtable) do
if v.Name == "Idle" then
v:Play(0.5, 1)
else
v:Stop()
end
end
end
if speed > 1 and speed < 10 then
for i, v in ipairs(animtable) do
if v.Name == "Walk" then
v:Play(0.5, 1)
else
v:Stop()
end
end
end
end)
Found a okay-ish fix. Smoothly blends into each other, but instead of doing AnimationTrack:Stop(), I constantly run the animation and adjust the weight instead, so if u want the animation to replay again from the start rather than midway, then figure it out yourself, sorry.
-- Services
local RunService = game:GetService("RunService")
-- Players
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
-- Anims
local Idle = script.Idle
local Walk = script.Walk
local Run = script.Run
-- table
local animtable = {
["Idle"] = animator:LoadAnimation(Idle),
["Walk"] = animator:LoadAnimation(Walk),
["Run"] = animator:LoadAnimation(Run)
}
for _, v in animtable do
v:Play( 0, 0.01, 1)
end
humanoid.Running:Connect(function(speed)
if speed < 1 then
for i, v in pairs(animtable) do
if v.Name == "Idle" then
v:AdjustWeight(1, 0.4)
else
v:AdjustWeight(0.01, 0.4)
end
end
end
if speed > 1 and speed < 10 then
for i, v in pairs(animtable) do
if v.Name == "Walk" then
v:AdjustWeight(1, 0.4)
else
v:AdjustWeight(0.01, 0.4)
end
end
end
if speed > 10 then
for i, v in pairs(animtable) do
if v.Name == "Run" then
v:AdjustWeight(1, 0.4)
else
v:AdjustWeight(0.01, 0.4)
end
end
end
end)