Script Fails to load animation sometimes

Hi there.

I have an emote script in my game, It works fine,
The issue is that sometimes (not so much) The animation fails, The entire script works, All its other functions work, But the animation itself doesn’t work, No errors at all (This is on a client script in StarterGUI for those wondering)

Note that if you respawn, it will fix itself.
If a player has the issue, they will have the issue the entire time before they respawn or something, So if they try to emote and unemote, it will still never fix itself.

I’ve looked over the forums if someone else is having this issue or a similar issue, But i can’t find any.

Providing the code would be unnecessary, as nothing in the code seems to mess with the animations, And like i said, No errors, It just doesn’t load.
Even when i first made the emote system for my game, I still had this problem a few times.

Sorry if this is the wrong category or if i did something wrong, this is my first time making a topic.

Hello InternalJohn41! I would love to assist you in your issue today.

Putting local scripts in StarterGui should work fine, but I would consider putting it into ReplicatedFirst instead. I have solved a couple issues in my LocalScripts by doing this, so why not give it a shot?

I haven’t worked with an emote script before, so I don’t know what to base my thought process on. It could actually help me if you do decide to show it, because your code could have an issue you might’ve not seen before. But my top three things I would check in the script is the :GetChildren and :FindFirstChild directories, the debounce, and the emote loading functionality.

Make sure you read through your script again, only this time try to go through the chronological process that a player would (from opening up the emote GUI to playing the emote).

I hope this helps!

Thanks, And yea i can provide a little edited snippet of the code here.

(i completely forgot how to show it as a script)

local function loadAnimation(character, emote)
local humanoid = character:WaitForChild(“Humanoid”)
local loadedAnim
– r15 and r6 support stuff
return loadedAnim
end

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
–starting the emote itself
local loadedAnim = loadAnimation(char, emote)

This is an edited version, i just have the important parts here
I dont believe the “Loadanimation” function is really the problem, since i only have that for r15 and r6 support, And this issue has been present for way longer, before i added r15 and r6 support.