Hi, everyone. First post here - and I’ve got a problem I’ve been headbutting for the past few hours.
I’m attempting to load animations onto my character’s humanoid, and I’m getting a consistent result; the animations aren’t playing. At first I assumed that the problem occurred because I was creating the Animation objects themselves client-side, but after re-initializing the localscript either by changing classes or resetting I received an error:
This error persists if I choose to instead create the objects from a serverscript and call LoadAnimation on them from the client. Stranger still, I played around with disabling scripts or commenting out chunks of code to dig to the root of the problem, and if I refrain from cloning certain scripts to the character’s class folder (which contains the core scripts) the issue desists. If I add a nominal wait time to the beginning of the class localscript before I call LoadAnimation (anywhere from 0.5 to 1s), the issue desists. The only commonality between the cloned scripts and the class script is that they both reference the player’s character and humanoid (CritBehavior, HPBehavior, StateBehavior).
Moreover, even when I perform the above workarounds necessary to cause my animations to load and play correctly, they do not replicate to the server when I utilize the Test Server mode in studio. I’ve read everywhere that this behavior is not intended and that animations can be played client-side whilst still replicating to other players.
I’ve done some digging into the topic and many similar threads suggested that the character and humanoid can exist without actually being part of the datamodel, and I tried the code they provided that they claimed fixed this particular error, to no avail. I’ve also tried waiting for the Animator object after first calling LoadAnimation, and the script proceeds as if one was created, despite the explorer showing I clearly have an empty humanoid.
If anyone’s encountering a similar issue or knows a fix, I’d appreciate your help. Thanks!
If a arbitrary wait fixes your problem, this is likely due to the character not being created fast enough. It seems like a really weird edge case. Maybe try using .CharacterAppearanceLoaded and wait for that event before loading the animation.
Update on this - I attempted to wait for and print the ‘Animator’ object as a fix, and the result is strange, if not silly.
function newAnim(id, n)
local new = i_n("Animation", char)
new.Name = n or "CoreAnim"
new.AnimationId = "rbxassetid://"..id
new = hume:LoadAnimation(new)
anims[#anims+1] = new
if not rig then rig = wfc(hume, "Animator")
idle = newAnim(3244974507, "Idle")
walk = newAnim(3245159860, "Walk")
jump = newAnim(3245188365, "Jump")
fall = newAnim(3245191409, "Fall")
slashA = newAnim(3245199497, "slashA")
slashB = newAnim(3245200447, "slashB")
slashC = newAnim(3245201437, "slashC")
The output returned that the Animator was in fact created, and yet when I searched the Explorer for it, I had a completely empty Humanoid…
Just a thought.
Would you please look into the HumanoidRootPart to see if there is what you are looking for.
I ask as I seem to recall seeing responses before where some items appeared there instead of in Humanoid.
I should mention that even if I add an arbitrary wait time to prevent the loading issue, the animations still don’t replicate to other players when I use the Test Server mode in Studio. This is consistent across all variations of loading, even if I use pre-made animation objects.