When the player joins, the code works but when they reset and the code runs again, the animation doesn’t work. How can this be fixed?
LocalScript in StarterPlayerScripts (most code has been snipped out):
if Humanoid.RigType == Enum.HumanoidRigType.R15 then
Animator:LoadAnimation(HoldObjectR15):Play()
elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
Animator:LoadAnimation(HoldObjectR6):Play()
end
You could probably place the script in StarterCharacterScripts. When your character resets, the old model is deleted and is replaced by a new one (I think). Since the script is in StarterPlayerScripts, the script wont refresh. When it refers to the Humanoid, it’s using the old one from their old model and not the Humanoid the player has in their new model. When the character resets, it gets a new model including scripts in the StarterCharacterScripts.
Things in StarterPlayerScripts run when the player joins the game. Things in StarterCharacterScripts run when a new character model is spawned (ie. respawning).
The script only ran once, and updated the animation controller of the original character. Once you respawned, it didn’t run again, so the animation controller didn’t update.