I made a game with multiple animations. I had a local script in StarterPack that said:
local player = game.Players.LocalPlayer.CharacterAdded:wait()
local hum = player.Humanoid
local anim1 = Instance.new("Animation")
anim1.AnimationId = "rbxassetid://614223605"
local anim2 = Instance.new("Animation")
anim2.AnimationId = "rbxassetid://614238458"
local anim3 = Instance.new("Animation")
anim3.AnimationId = "rbxassetid://614517450"
local anim4 = Instance.new("Animation")
anim4.AnimationId = "rbxassetid://614505864"
local anim5 = Instance.new("Animation")
anim5.AnimationId = "rbxassetid://614766277"
local anim6 = Instance.new("Animation")
anim6.AnimationId = "rbxassetid://614786449"
local anim7 = Instance.new("Animation")
anim7.AnimationId = "rbxassetid://614845860"
local anim8 = Instance.new("Animation")
anim8.AnimationId = "rbxassetid://616195171"
local anim9 = Instance.new("Animation")
anim9.AnimationId = "rbxassetid://616241532"
local anim10 = Instance.new("Animation")
anim10.AnimationId = "rbxassetid://637850153"
local anim11 = Instance.new("Animation")
anim11.AnimationId = "rbxassetid://637860750"
local anim12 = Instance.new("Animation")
anim11.AnimationId = "rbxassetid://638007029"
game:GetService("UserInputService").InputBegan:connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.H then
hum:LoadAnimation(anim1):Play()
elseif input.KeyCode == Enum.KeyCode.F then
hum:LoadAnimation(anim2):Play()
elseif input.KeyCode == Enum.KeyCode.B then
hum:LoadAnimation(anim3):Play()
elseif input.KeyCode == Enum.KeyCode.V then
hum:LoadAnimation(anim4):Play()
elseif input.KeyCode == Enum.KeyCode.G then
hum:LoadAnimation(anim5):Play()
elseif input.KeyCode == Enum.KeyCode.R then
hum:LoadAnimation(anim6):Play()
elseif input.KeyCode == Enum.KeyCode.L then
hum:LoadAnimation(anim7):Play()
elseif input.KeyCode == Enum.KeyCode.K then
hum:LoadAnimation(anim8):Play()
elseif input.KeyCode == Enum.KeyCode.Q then
hum:LoadAnimation(anim9):Play()
elseif input.KeyCode == Enum.KeyCode.P then
hum:LoadAnimation(anim10):Play()
elseif input.KeyCode == Enum.KeyCode.J then
hum:LoadAnimation(anim11):Play()
elseif input.KeyCode == Enum.KeyCode.M then
hum:LoadAnimation(anim12):Play()
end
end)
When I tested these in Test Mode in studio, they worked perfectly fine, but when I tested them in the actual game, nothing happened whenever I pressed the keys. Can anyone explain to me why this happened and how I can fix it?

3 comments
Try
local hum = player:WaitForChild("Humanoid")add repeat wait() until player.Character:FindFirstChild('Humanoid')
after anim12 the id is anim11, it's not the problem but anim12 will be the same as anim11 otherwise