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.
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!
EDIT: using an npc zombie from the toolbox WORKS but using my model doesn’t!