Tower Defense Game: Enemies Not Spawning (HumanoidRootPart not valid member of Model)

Hello! My friend and I are making a Tower Defense game (using @GnomeCode’s tutorial), and we are using models for the enemies instead of NPCs. We are trying to achieve the enemies spawning without any errors. The issue, is that every time we playtest the game, the following red error pops up inside of the Output:

HumanoidRootPart is not a valid member of Model "Normal" - Server - Mob:24
Mobule Script 1: Mob (the one with the error)
local ServerStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
    local humanoid = mob:WaitForChild("Humanoid")
    local waypoints = map.Waypoints

    for waypoint = 1, #waypoints:GetChildren() do
        humanoid:MoveTo(waypoints[waypoint].Position)
        humanoid.MoveToFinished:Wait()
    end

    mob:Destroy()

end

function mob.Spawn(name, quantity, map)
    local mobExists = ServerStorage.Mobs:FindFirstChild(name)

    if mobExists then
        for i=1, quantity do
            task.wait(0.5)
            local newMob = mobExists:Clone()
            newMob.HumanoidRootPart.CFrame = map.Start.CFrame
            newMob.Parent = map.Mob

            coroutine.wrap(mob.Move)(newMob, map)
        end

    else
        warn("Requested mob does not exist:", name)
    end
end

return mob
Normal Script 2: Main
for wave=1, 5 do
    print("WAVE STARTING:", wave)
    if wave < 5 then
        mob.Spawn("Normal", 3 * wave, map)
    elseif wave == 5 then
        mob.Spawn("Normal", 100, map)
    end

    repeat
        task.wait(1)
    until #map.Mob:GetChildren() == 0

    print("WAVE ENDED")
    task.wait(1)
end

Here is what our explorer looks like for the specific enemy with the issue.
Screenshot 2023-07-26 1.15.15 PM

We have already tried editing line 24 on script 1 (newMob.HumanoidRootPart.CFrame = map.Start.CFrame) to this:

newMob.ServerStorage.Mobs.Normal.MeshPart.Noob.HumanoidRootPart.CFrame = map.Start.CFrame

Thanks for reading, please reply if you can help us in any way possible. Have a great day! :wave:

EDIT: using an npc zombie from the toolbox WORKS but using my model doesn’t!

6 Likes

newMob.ServerStorage.Mobs.Normal.MeshPart.Noob.HumanoidRootPart.CFrame = map.Start.CFrame

What is the Error message for this?

2 Likes

newMob.ServerStorage.Mobs.Normal.MeshPart.Noob.HumanoidRootPart.CFrame = map.Start.CFrame

Have you tried setting it to specifically it such as to see if it just cant find the part or is an error with the actual model itself
ServerStorage.Mobs.Normal.MeshPart.Noob.HumanoidRootPart.CFrame = map.Start.CFrame

and try swapping these around

newMob.HumanoidRootPart.CFrame = map.Start.CFrame
newMob.Parent = map.Mob
3 Likes

ServerStorage is not a valid member of Model “Normal”

1 Like

Here are the 2 errors that occur there, probably because newMob isn’t there:

Failed to load animation: rbxassetid://13672834385 - Studio

Infinite yield possible on ‘Workspace.Grassland.Mob.Normal:WaitForChild(“Humanoid”)’

1 Like

Switching them did not change the error

1 Like

This is the line in which we declare newMob:

local newMob = mobExists:Clone()

1 Like

Edit made, look at the bottom of the original post

1 Like