local function X(X)wait(1)local l=X:WaitForChild("\072\117\109\097\110\111\105\100")for X,l in pairs(l:GetPlayingAnimationTracks())do l:Stop(0)end local x=X:WaitForChild("\065\110\105\109\097\116\101")for X,l in ipairs(replacementAnimations)do if not l.isLoaded then continue end local I=(x:WaitForChild(l.name)):GetChildren()for X,x in ipairs(I)do x.AnimationId=l.id;(x:GetPropertyChangedSignal("\065\110\105\109\097\116\105\111\110\073\100")):Connect(function()x.AnimationId=l.id end)end end for X,l in pairs(l:GetPlayingAnimationTracks())do l:Stop()l:Destroy()end end local function l(l)local x=l.Character or l.CharacterAdded:wait()X(x)end

local function onCharacterAdded(character)
	wait(1) -- You want to wait for the Animate script to load and run
	
	local humanoid = character:WaitForChild("Humanoid")
	for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingTracks:Stop(0)
	end
 
	local animateScript = character:WaitForChild("Animate")
	
	for _, anim in ipairs(replacementAnimations) do
		if not anim.isLoaded then continue end

		local animations = animateScript:WaitForChild(anim.name):GetChildren()
		-- Overwrite the IDs of all idle animation instances
		for _, animVariant in ipairs(animations) do
			animVariant.AnimationId = anim.id

			-- If you really want to prevent the animations from being changed by something else you could do this too
			animVariant:GetPropertyChangedSignal("AnimationId"):Connect(function()
				animVariant.AnimationId = anim.id
			end)
		end
	end
	
	-- Stop all currently playing animation tracks on the player
	for _, playingAnimation in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingAnimation:Stop()
		playingAnimation:Destroy()
	end
end
 
local function onPlayerAdded(player)
	--Only run this code if an animation actually is loaded in. 
	local character = player.Character or player.CharacterAdded:wait()
	onCharacterAdded(character)
end

