Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why do all my animations break when the character respawns?

Error: LoadAnimation requires the Humanoid object (jamespringles.Humanoid) to be a descendant of the game object

From my research people are saying how the character isnt loaded yet or the humanoid isnt loaded or its still referring to the old humanoid. Here's what I've tried and it still gives me the error

local gripAnimation = character.PlayerAnimations.PistolGrip
local gripTrack = humanoid:LoadAnimation(gripAnimation)


local function onCharacterAdded(new)
	character = new
	humanoid = character:WaitForChild("Humanoid")
	local gripAnimation2 = character.PlayerAnimations.PistolGrip
	local gripTrack2 = humanoid:LoadAnimation(gripAnimation2)
	gripTrack = gripTrack2
end
player.CharacterAdded:Connect(onCharacterAdded)

I then read that this animation method is deprecated, but I don't understand how the new animation API works and how I can animate it on a local script.

https://developer.roblox.com/en-us/api-reference/class/Animator I've tried using the new Animation API, but it can only be used on severscripts and if I fire something from the client to the server I can't access the same animation to :Stop() it I also can't send the Animation object from the client to the server because every time i send it, it just shows up as nil.

1 answer

the new method is simple instead of doing humanoid:LoadAnimation(animation), you just do humanoid:WaitForChild("Animator"):LoadAnimation(animation)

2 comments

0

and then, you have to play the animation by doing humanoid:WaitForChild("Animator"):LoadAnimation(animation):Play()

0

it can still be used in local script, i tried with a sword.

This discussion is preserved as it was. New answers, comments, and votes are closed.