Im using custom characters in my game which means they need custom idle and walk animations, however when inpractice, the animations are really twitchy and sometimes even t-pose (not in video)
Animate script
local run = game.ReplicatedStorage.Remotes.Run
local Player = game.Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local Idle = Instance.new("Animation")
local db = false
Idle.AnimationId = "rbxassetid://13779417516"
local Walk = Instance.new("Animation")
Walk.AnimationId = "rbxassetid://14176814119"
repeat task.wait() until script:FindFirstChildWhichIsA("Animation")
local idleAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
idleAnim.Looped = true
idleAnim.Priority = Enum.AnimationPriority.Idle
local runAnim = script.Parent.Humanoid.Animator:LoadAnimation(Walk)
runAnim.Looped = true
runAnim.Priority = Enum.AnimationPriority.Movement
local jumpAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
jumpAnim.Looped = true
jumpAnim.Priority = Enum.AnimationPriority.Idle
local climbAnim = script.Parent.Humanoid.Animator:LoadAnimation(Walk)
climbAnim.Looped = true
climbAnim.Priority = Enum.AnimationPriority.Movement
local fallAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
fallAnim.Looped = true
fallAnim.Priority = Enum.AnimationPriority.Idle
local swimAnim = script.Parent.Humanoid.Animator:LoadAnimation(Walk)
swimAnim.Looped = true
swimAnim.Priority = Enum.AnimationPriority.Movement
local sitAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
sitAnim.Looped = true
sitAnim.Priority = Enum.AnimationPriority.Idle
local coreAnim = script.Parent.Humanoid.Animator:LoadAnimation(Idle)
coreAnim.Looped = true
coreAnim.Priority = Enum.AnimationPriority.Core
game["Run Service"].Heartbeat:Connect(function()
if script.Parent.HumanoidRootPart.Velocity.Magnitude > 0.1 then
if script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Dead then
for _, i in script.Parent.Humanoid:GetPlayingAnimationTracks() do
i:Stop()
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
if not sitAnim.IsPlaying then
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Jumping then
if not jumpAnim.IsPlaying then
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Climbing then
if not climbAnim.IsPlaying then
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
if not fallAnim.IsPlaying then
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then
if not swimAnim.IsPlaying then
run:FireServer(Walk)
end
elseif script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Running then
if not runAnim.IsPlaying then
repeat
runAnim:Play()
wait(1.2)
until script.Parent.HumanoidRootPart.Velocity.Magnitude < 0.1
print("fired")
db = false
end
end
else
for _, i in script.Parent.Humanoid:GetPlayingAnimationTracks() do
if i.Name ~= "Idle" then
i:Stop()
end
end
if not idleAnim.IsPlaying then
idleAnim:Play()
end
end
end)