I dont know why but my table is not printing
local EnemiesUpFront = {}
local EnemiesStrongest = {}
workspace.Rigs.Zombies.ChildAdded:Connect(function(Model)
table.insert(EnemiesStrongest,1,Model.HumanoidRootPart.Health)
end)
while wait() do
table.sort(EnemiesStrongest, function(a, b)
return a.Value < b.Value
end)
print(EnemiesStrongest)
end
maybe try doing
print(table.concat(EnemiesStrongest, " ")
its working but it errors
one of your values in the table is invalid
but its just the same parts but different
it detects if child got added then grabs the childs health
oh, maybe try doing
for _, v in pairs(EnemiesStrongest) do
print(v)
end
to see which value errors
1 Like
it doesnt print anymore
the script
local EnemiesUpFront = {}
local EnemiesStrongest = {}
game.Workspace.Rigs.Zombies.ChildAdded:Connect(function(Model)
table.insert(EnemiesStrongest,1,Model.HumanoidRootPart.Health)
end)
while wait() do
table.sort(EnemiesStrongest, function(a, b)
return a.Value < b.Value
end)
for _, v in pairs(EnemiesStrongest) do
print(v)
end
end
wait, why are you getting the health property from the humanoid root part?
its custom rig it doesnt have humanoid
i use intvalue i fixed it its printing the numbers
yeah i added value because its grabbing the health and the health is an intvalue so i added .value
1 Like