i have tried using GetChildren however it doesn't work
local serverstorage = game:GetService("ServerStorage")
local replicatedstorage = game:GetService("ReplicatedStorage")
local zombie = serverstorage:WaitForChild("zombie")
local pl = game:GetService("Players")
local p = pl:GetPlayers()
while wait(1) do
if #game.Workspace.zombies:GetChildren() == 0 then
for i =0 , _G.dead, 1 do
local zom = zombie:Clone()
local me = game.Workspace[tostring(_G.pl[math.random(1,#_G.pl)])]
zom.Parent = game.Workspace.zombies
zom:SetPrimaryPartCFrame(me.HumanoidRootPart.CFrame * CFrame.new(math.random(1,100),10,math.random(1,100)))
local npc = game.Workspace.zombies:WaitForChild("zombie")
local RunAnim = npc.Zombie.runanim
local loadrun = npc.Zombie:LoadAnimation(RunAnim)
loadrun:Play()
end
end
end
how can i make it so that the animation plays on the zombie that i just spawned not the first in the folder?
