Changing Default Animations, is there an easy way to do it?

Here is the basic version of the way I do it. (Server Script)

local NewAnimationID = 619543231

local function ChangeAnimation(character, animationId)
	local Animator = character.Animate
	local NewPose
	
	local success, err = pcall(function() 
		local Model = game.InsertService:LoadAsset(animationId)
		local Folder = Model:GetChildren()[1]
		NewPose = Folder:GetChildren()[1]
	end)
	
	if success then
		local OldPose = Animator:FindFirstChild(NewPose.Name)
		if OldPose then
			OldPose:Destroy()
			NewPose.Parent = Animator
		end
	end
end

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		ChangeAnimation(character, NewAnimationID)
	end)
end)

You can make it more complicated to work for whole animation packages, this is just for the individual animations.
(EDITS: kept optimizing XD)

11 Likes