I'm very new with Lua, and I'm designing a new game similar to black ops zombies but instead of fighting zombies you fight wild animals like bears and foxes, I have made the models for the animals, but I can't seem to find any tutorials on how to make an animated enemy NPC rig that does not use the regular roblox body. I'm thinking sort of like the animals in swordburst

I have a basic follow script, but I'm not quite sure how to incorperate this into my animated enemy NPC

local larm = script.Parent:FindFirstChild("HumanoidRootPart")
02	local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
03	 
04	function findNearestTorso(pos)
05	    local list = game.Workspace:children()
06	    local torso = nil
07	    local dist = 45
08	    local temp = nil
09	    local human = nil
10	    local temp2 = nil
11	    for x = 1, #list do
12	        temp2 = list[x]
13	        if (temp2.className == "Model") and (temp2 ~= script.Parent) then
14	            temp = temp2:findFirstChild("HumanoidRootPart")
15	            human = temp2:findFirstChild("Humanoid")
16	            if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
17	                if (temp.Position - pos).magnitude < dist then
18	                    torso = temp
19	                    dist = (temp.Position - pos).magnitude
20	                end
21	            end
22	        end
23	    end
24	    return torso
25	end
26	 
27	 
28	 
29	 
30	while true do
31	    wait(1)
32	    local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
33	    if target ~= nil then
34	        script.Parent.Zombie:MoveTo(target.Position, target)
35	    end
36	 
37	end

If you have any videos or know how I can do this I would really appreciate it.

4 comments

0

:children() is deprecated and has been removed, use :GetChildren(). :findFirstChild() is also deprecated so use :FindFirstChild().

0

you could make a animation for custom NPCS, but you'll need to add Motor6Ds to the character to animate

0

wait(1) A man of culture, I see.

0

This is a free model zombie script you got from the toolbox. This isn't your own code. We only help people who have issues with code they've made themselves. https://wiki.roblox.com/index.php?title=User:Nelson/Custom_Character_Creator_(Plugin) is a good place to start custom rigging.