@TheKgroup if you don’t explain it better i’ll stay here like a fool looking for a solution
so using for i,v in pairs()do put GetPlayers() and GetChildren()
local Array = {}
for i,v in pairs(game.Players:GetChildren())do
table.insert(Array,v)
end
and you’d do that with the other table as well. then you can loop through Array.
i need to make a second array?
local Array = {}
for i,v in pairs(game.Players:GetChildren(), game:GetService("Workspace").Npcs:GetChildren())do
table.insert(Array,v)
end
I’m doing my best … I’m trying hard …
This is exactly what you’d use CollectionService for. Every time a player’s character spawns in you add a tag to their humanoid then just use the GetTagged function to get all the humanoids in one line of code.
Like this?
local CollectionService = game:GetService("CollectionService")
game.Player.PlayerAdded:Connect(function(Player)
local Char = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
CollectionService:AddTag(Humanoid, "Humanoids")
end)