Default animations interfere with custom animations?

Im trying to play some custom animations but the players default animations are disrupting them. I tried using a loop and GetPlayingAnimationTracks() to stop all running animations but this didnt work. here is my script:

--load all animation info
local animationidle = Instance.new("Animation")
animationidle.Name = "Idle"
animationidle.AnimationId = "http://www.roblox.com/AssetID?=3547072175"

local animationcrawl = Instance.new("Animation")
animationcrawl.Name = "Crawl"
animationcrawl.AnimationId = "3547113686"

local hum = script.Parent.Parent.Humanoid
	local loadidle = hum:LoadAnimation(animationidle)
--

for i, track in next, hum:GetPlayingAnimationTracks() do
		track:Stop()
end

--animation controls
script.Parent.CrawlTrig.OnServerEvent:Connect(function()
	
	loadidle:Play() 
end)

script.Parent.StandTrig.OnServerEvent:Connect(function()
	loadidle:Stop()
end)
--
3 Likes

The reason is that your custom animations are not at a high enough AnimationPriority above the default animations. To fix this, set the Priority to Action.

AnimationTrack.Priority = Enum.AnimationPriority.Action
2 Likes

here is my correction:

--load all animation info
local animationidle = Instance.new("Animation")
animationidle.Name = "Idle"
animationidle.AnimationId = "http://www.roblox.com/AssetID?=3547072175"

local animationcrawl = Instance.new("Animation")
animationcrawl.Name = "Crawl"
animationcrawl.AnimationId = "3547113686"

local hum = script.Parent.Parent.Humanoid
	local loadidle = hum:LoadAnimation(animationidle)
	loadidle.Priority = Enum.AnimationPriority.Action
--



--set default animations to lowest priority
for i, track in next, hum:GetPlayingAnimationTracks() do
		track.Priority = Enum.AnimationPriority.Core
end
--



--animation controls
script.Parent.CrawlTrig.OnServerEvent:Connect(function()
	loadidle:Play() 
end)

script.Parent.StandTrig.OnServerEvent:Connect(function()
	loadidle:Stop()
end)
--

I tried changing all the default animations to the lowest priority, but the default walking animation still overides the custom animation. I also tried removing the animate localscript inside the character to see what would happen and only when I do that will my custom animations run like expected. but I still need some default animations so this isnt an option.

Remove the for loop, you are setting your already loaded custom animation to Core along with the rest. The loop is not needed at this point.

I removed the for loop code block, and even tried putting it to the top before loading the custom animations but its still being disrupted.

You can try setting the Priority by loading the animation into the Animation Editor and using the options in the UI. I’ve had this issue in the past and setting priority through the animation editor has worked for me.

6 Likes

setting priority in the editor works.

1 Like

Thank you for this tip. I was working on swapping out the running animation ID with my custom ID and things just weren’t going great for a few long hours. THANK YOU!! Setting priority to “action” did the trick!

1 Like

remember to animate that part if that part is shaking from the defualt animation