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

Why cant I load my animation to my custom rig?

I made a gun and tried to animate it. It has a Humanoid and a Root part (primary part) so it makes a custom rig. However, whenever I try to play the animation it wont work. I made a different script before and it worked perfectly

script 1

local gun = game.ReplicatedStorage.GunModels.MP40:Clone()

local mp40idle = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.Modules.SETTINGS.Animations.MP40.Idle)

mp40idle:Play()

script 2

local gun = game.ReplicatedStorage.WeaponsModels.MOSINNAGANT:Clone()

local idle = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponModules.MosinNagant.AnimationsFolder.Idle)

idle:Play() 

Can anyone please explain to me why script 1 wont work but script 2 works? The error is that the script couldnt find the Humanoid inside the cloned model.

1 answer

✓ Accepted answer

Clone

The trick is that when you clone something, it doesn't actually have the Parent set. You need the model to have its Parent set to something before the animation track can be loaded, because for whatever reason Roblox insists that everything must be a part of the DataModel (especially when it isn't yet)

6 comments

0

I have a very similar script, just different model name. It also has a Humanoid and its cloned, yet I can Load the animation and the whole ""Parent" thing works.

0

Okay but you still need to set the Parent before loading the animation

0

So rather than saying what is basically the equivalent of "It works on my machine" how about you try out my solution by setting the Parent first and then tell me if it works or not

0

Now I fixed it, I found the model manually by finding it inside the camera so I will be able to find the Humanoid. Thanks. Its still wierd to me since I got the exact same script with different model and variable names and it works. (I editted my question for you to see) Thanks again for the help.

0

:Clone().Parent = workspace

0

Hi eLunate :3

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