Custom default animations not working as intended

Hello! I’ve had a problem for a few days now and I’ve been trying to research it as much as possible but it looks like it’s come to this as I’ve found nothing that’s helped. Roblox has an animation bundle that I want to use in my game. It’s the OldSchool animation bundle. I’ve tried using multiple scripts and tutorials to try and implement these animations. Usually what happens (not every test) is my avatar just stays still without movement, including walking, running, staying idle, etc. It just stays still.

All I want is to just implement one of Roblox’s animations into my game and make it the default animation basically. Here’s an example script I’ve tried and also a screenshot of my body just staying still: (First person view game, which shouldn’t be the reason for this error)

There’s sometimes error messages which I cannot seem to debug. Here’s one example:

Please help me if you could! Any help is much appreciated and feel free to ask me any questions!

Server Script inside ServerScriptService

-- LOCALS

local Players = game:GetService("Players")

-- MAIN FUNCTION THAT ENABLES ANIMATIONS

local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")

	for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingTracks:Stop(0)
	end

	local animateScript = character:WaitForChild("Animate")
	wait(2)
	animateScript.run.RunAnim.AnimationId = "rbxassetid://5319900634"        -- Run
	animateScript.walk.WalkAnim.AnimationId = "rbxassetid://5319909330"      -- Walk
	animateScript.jump.JumpAnim.AnimationId = "rbxassetid://5319917561"      -- Jump
	animateScript.idle.Animation1.AnimationId = "rbxassetid://5319922112"    -- Idle (Variation 1)
	animateScript.idle.Animation2.AnimationId = "rbxassetid://5319922112"    -- Idle (Variation 2)
	animateScript.fall.FallAnim.AnimationId = "rbxassetid://5319914476"      -- Fall
	animateScript.swim.Swim.AnimationId = "rbxassetid://5319927054"          -- Swim (Active)
	animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://5319927054"  -- Swim (Idle)
	animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://5319931619"    -- Climb
end

-- PLAYER ADDED FUNCTION

local function onPlayerAdded(player)
	player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end

-- CALLING THE FUNCTION PLAYER ADDED

Players.PlayerAdded:Connect(onPlayerAdded)

1 Like

Update to my problem! It seems like only some of Roblox’s animations are working but not others such as the Old School animation. Why is this?

I was going to suggest changing the start of the links to what roblox used in the default animations, but since you said that some animations work like this, I’m not entirely sure what’s happening. Maybe you typed the IDs wrong (unless you copy-pased them).
You don’t need to put this all in a script though, you can just copy the Animate script and all it’s children and put it in StarterCharacterScripts with the modified animations already added.

Tried :FindFirstChild() yet?

Nope. The FFlag in Roblox is disabled by default for custom animations. You need to fork the animate script.

Edit: I suppose you could replace the animations via Animator:GetPlayingAnimationTracks or another method.

Thats sign that the IDs could be wrong.
Where did you get the Animation IDs of the Bundle?

Maybe thats the issue, you could get the right IDs by checking the details of the Bundle with AssetService, then you could use those IDs with InsertService so you can get the StringValues that holds the Animations, then you could replace the StringValues inside the Animate script, just make sure you Stop() all anim tracks and disable the Animate script during the process, at the end enable it again.
And you could connect a function when respawning so when players dies they get the Bundle values again, I made a script that does that for this video:

The Oldschool bundle id is 667, just edit the very first line.

local BundleToGet = 75 -- Ninja Animation Bundle

local GameAnimBundle = false

local InsertService = game:GetService("InsertService")
local AssetService = game:GetService("AssetService")

local function GetBundleAnims()
	local AssetDone, BundleDetails = pcall(function()
		return AssetService:GetBundleDetailsAsync(BundleToGet)
	end)
	
	if AssetDone and BundleDetails then
		GameAnimBundle = {}
		for _, itm in pairs(BundleDetails["Items"]) do
			local InsertDone, result = pcall(function()
				return InsertService:LoadAsset(itm["Id"])
			end)
			if InsertDone and result then
				for _, c in pairs(result:GetDescendants()) do
					if c:IsA("StringValue") then
						warn(c.Name)
						table.insert(GameAnimBundle, c)
						break
					end
				end
			else
				--warn("ERROR:", result) -- Some bundles contains a Name key which is not an animation
			end
		end
		return GameAnimBundle
	else
		warn("ERROR:", BundleDetails)
		return false
	end

end

local function ChangePlayerAnims(plr)
	local CHAR = plr.Character or plr.CharacterAdded:Wait()
	local HUM = CHAR:WaitForChild("Humanoid")
	local Animate = CHAR:WaitForChild("Animate")
	Animate.Enabled = false

	for _, a in pairs(HUM:WaitForChild("Animator"):GetPlayingAnimationTracks()) do
		a:Stop()
	end

	for _, ani in pairs(GameAnimBundle) do
		Animate:FindFirstChild(ani.Name):Destroy()
		ani:Clone().Parent = Animate
	end

	Animate.Enabled = true
end

game.Players.PlayerAdded:Connect(function(plr)
	warn(plr, "joined")
	
	if GameAnimBundle then
		ChangePlayerAnims(plr)
	else
		if GetBundleAnims() then
			ChangePlayerAnims(plr)
		end
	end
	
	plr.CharacterAdded:Connect(function()
		warn("spawn")
		ChangePlayerAnims(plr)
	end)
end)

That is just an example that works. You could improve it. For example, theres no reason to Load the Bundle animations into the GameAnimBundle table at the start of the game, even if only happens once would be better to save all those StringValues into ServerStorage, and place them on players when they join.

Hey! Thanks so much! My problem was that I got the animation ID’s from the bundle under the “what it includes” and then I come back here and I tried this and it works! Thank you so much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.