Custom animations bug out when they first play

Ive copied the default Animate script and changed the animation IDs to my own custom animations. But i noticed that whenever i first walk/ jump, the character switches to a blank pose for a moment before the animation plays. Is there any way i can fix this? The only modifications i made to the script was commenting out the part that detects /e commands.

-p.s. im not sure if this counts as scripting support but i assumed i might have to change the script some to get it working right.

does your walk animation starts with a keyframes of a blank pose?

Hi, im pretty sure the problem here is the asset isnt loaded before actually using the animations. :LoadAnimation() should do the trick, but since you are using the default animate script its gonna be tedious to implement, which is why i recommend :PreloadAsync().

When you are using :PreloadAsync() you should be passing instances though, and it also yields the current thread so i either recommend using task.spawn() or making a loading screen for your game.

local ContentProvider = game:GetService("ContentProvider")

local animation1 = Instance.new("Animation")
animation1.SoundId = "rbxassetid://ANIMATION_ID1"
local animation2 = Instance.new("Animation")
animation2.SoundId = "rbxassetid://ANIMATION_ID2"

local assets = {
	animation1,
	animation2
}

-- This will be hit as each asset resolves [OPTIONAL]
local callback = function(assetId, assetFetchStatus)
	print("PreloadAsync() resolved asset ID:", assetId)
	print("PreloadAsync() final AssetFetchStatus:", assetFetchStatus)
end

-- Preload the content and time it
local startTime = os.clock()
ContentProvider:PreloadAsync(assets, callback) -- ONLY THIS IS NECESSARY
local deltaTime = os.clock() - startTime
print(("Preloading complete, took %.2f seconds"):format(deltaTime))
1 Like

I modified your code a bit and added an assets folder to my replicated storage that will hold any animations and other assets i might need to preload into it. It seems to work well!

Heres the code incase im doing something wrong but it seems to be working:

-- Code originally from DevDaniel_House on the roblox dev forum
-- Modified to use assets folder

local ContentProvider = game:GetService("ContentProvider")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local assets = {}

-- Collect all assets in the assets folder
for i, asset in pairs(ReplicatedStorage.Assets:GetDescendants()) do
	if not asset:IsA("Folder") then
		table.insert(assets, asset)
	end
end

-- This will be hit as each asset resolves [OPTIONAL]
local callback = function(assetId, assetFetchStatus)
	print("PreloadAsync() resolved asset ID:", assetId)
	print("PreloadAsync() final AssetFetchStatus:", assetFetchStatus)
end

-- Preload the content and time it
local startTime = os.clock()
ContentProvider:PreloadAsync(assets, callback) -- ONLY THIS IS NECESSARY
local deltaTime = os.clock() - startTime
print(("Preloading complete, took %.2f seconds"):format(deltaTime))

-- Disable Loading Gui
script.Parent.Enabled = false


im probably gonna make another script that puts this in the PlayerGui when you join the game so that it doesnt just keep loading when you respawn

Oh you can prevent that by disabling the ScreenGUIs ResetOnSpawn property or just deleting the screen gui after the loading is done.

1 Like

Will do!

characterminimumcharacterminimum