local function G(G)wait(1)local z=G:WaitForChild("\072\117\109\097\110\111\105\100")for G,z in pairs(z:GetPlayingAnimationTracks())do z:Stop(0)end local q=G:WaitForChild("\065\110\105\109\097\116\101")for G,z in ipairs(replacementAnimations)do if not z.isLoaded then continue end local u=(q:WaitForChild(z.name)):GetChildren()for G,q in ipairs(u)do q.AnimationId=z.id;(q:GetPropertyChangedSignal("\065\110\105\109\097\116\105\111\110\073\100")):Connect(function()q.AnimationId=z.id end)end end for G,z in pairs(z:GetPlayingAnimationTracks())do z:Stop()z:Destroy()end end local function z(z)local q=z.Character or z.CharacterAdded:wait()G(q)end
-- Local Functions
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
