It works just fine when i move the loadanimation part OUTSIDE of the loop, i am not sure why…
local event = game.ReplicatedStorage:WaitForChild("ClientReplicator")
local groups = {}
local animations = game.ReplicatedStorage:WaitForChild("Animations")
local anims2 = game.ReplicatedStorage:WaitForChild("anims2")
event.OnClientEvent:Connect(function(group,state)
if not groups[table.find(groups,group)] then
table.insert(groups,group)
print(group)
for _,char in pairs(group) do
print(char)
print(char.Humanoid)
local atease = char.Humanoid:LoadAnimation(animations.Idle)
local aim = char.Humanoid:LoadAnimation(animations.Aim)
local reload = char.Humanoid:LoadAnimation(animations.Reload)
local idle = char.Humanoid:LoadAnimation(anims2.Idle)
local walk = char.Humanoid:LoadAnimation(anims2.WalkAnim)
local run = char.Humanoid:LoadAnimation(anims2.RunAnim)
local jump = char.Humanoid:LoadAnimation(anims2.JumpAnim)
local CharGroup = {
char,
atease,
aim,
reload,
idle,
walk,
run,
jump
}
table.insert(group,CharGroup)
end
print(groups)
else
end
end)
try making a local for the humanoid before you start the loop, also you should consider using Humanoid.Animator:LoadAnimation() instead as Humanoid:LoadAnimation() is deprecated
Problem persists. What i’m trying to do is load a bunch of animations on hundreds of chars then store them in a group table where i can individually play each one
The first time you define the characters humanoid, you should use char:WaitForChild("Humanoid", 5)
This is largely due to the fact that your loop is likely moving too quick, adding that wait will wait until it can tell that the humanoid exists, making sure it isn’t nil