Best way to change core walk/running animations during the game runtime?

It’s actually relatively trivial, in my own research I stumbled across a few threads but none of them had found a solution, all you need to do is locate the desired animation object from within the ‘Animate’ script and change its ID. The following script changes the default run animation to the ninja run animation.

local Game = game
local Players = Game:GetService("Players")

local function OnPlayerAdded(Player)
	local function OnCharacterAdded(Character)
		local Animate = Character:FindFirstChild("Animate") or Character:WaitForChild("Animator")
		local Run = Animate:FindFirstChild("run") or Animate:WaitForChild("run")
		local RunAnimation = Run:FindFirstChildOfClass("Animation") or Run:WaitForChild("RunAnim")
		RunAnimation.AnimationId = "rbxassetid://656118852"
	end
	
	Player.CharacterAdded:Connect(OnCharacterAdded)
end

Players.PlayerAdded:Connect(OnPlayerAdded)
5 Likes