LoadAnimation not working

So my game Shoot has a Dummy that plays a Animation in Studio it looks so:


and on Website, App:

and the Code:

local h = script.Parent:FindFirstChild("Humanoid")

local a = h:LoadAnimation(script.Animation)
a:Play()

Idk why.

Try using this?

local h = script.Parent:FindFirstChild("Humanoid")
local animator = h:FindFirstChild("Animator")

animator:LoadAnimation(script.Animation)

And do you own the animation?

2 Likes

Yes i own the Animation and its not working
And other animation failed to load:
Studio:


App, Wbsite:

Gonna go old school, try this

try this:

local h = script.Parent:FindFirstChild("Humanoid")
local animator = h:LoadAnimation(script.Animation)
animator:Play()

Do this so we can see if the issue lies somewhere entirely different.

1 Like

Make sure the dummy is properly rigged with the HumanoidRootPart being the primary part of the model.

1 Like

Also going to ask if your even playing the Instance

this is not meant to be this but rather this

local h = script.Parent:FindFirstChild("Humanoid")
local animation = h:LoadAnimation(script.Animation)
animation:Play()
2 Likes

It’s better if it’s done using this

local h = script.Parent:FindFirstChild("Humanoid")
local animation = h.Animator:LoadAnimation(script.Animation)
animation:Play()

As LoadAnimation on Humanoids is deprecated, but both should work anyways

@chexedy Yes I know that deprecated objects can be worse off to use, but we were giving an alternate choice if something goes wrong when trying to load it with the Animator.

@baum2409 Is the code that me or @CreepingGamingTV gave you not working either? If so something’s going on with the animation or something else is up

3 Likes

Yeah why I said old school :smiley:
Either way it should run no matter the implementation, though as you said I would rather have OP use your method

2 Likes

just because it works doesnt mean you should it considering it’s deprecated, it’s terrible practice

@baum2409 can i see the dev console when you test it in player?

1 Like

So i looked in the Dev Console and Output and nothing there.

are you using a regular script or LocalScript

Local script or not animations run regardless, the issue OP has is that it’s running in studio though not in the website, is what my interpretation is from what he said. I may be wrong.

its a normal script.
but a question why is it in Studio working and not on Wbsite or App?

hmmmm that’s weird, if you ran it on a LocalScript you could try ContentProvider:PreloadAsync (as the animation may not have loaded) but I’m not sure if that’s how Animations work. maybe try preloading the asset?

1 Like

Did you remember to publish the changes from studio to the website? Stupid question but it could be that. There’s not much else it could be.

If you did publish, then maybe make th script wait for a few seconds before loading and playing?

i publish the game. and tried Filtering Enabled. but year… and animation

might be a bug, try and publish it as a new game and then try

Try this?

wait(5)
local h = script.Parent:FindFirstChild("Humanoid")
local animation = h.Animator:LoadAnimation(script.Animation)
animation:Play()

waits 5 seconds then plays. If it still doesn’t palys then it could something wrong with the place as @Furkan5E said?

1 Like

try preloading the asset in a LocalScript:

local ContentProvider = game:GetService("ContentProvider")
ContentProvider:PreloadAsync({"rbxassetid://idhere"})

i dont know if this is true but my theory is that it hasnt loaded on the client for a reason
preloadasync returns an error if there is an issue loading a specific id, and preloading it will help us find out what’s the problem

1 Like

Yeah I agree, this might be it.

1 Like