So I've made a RPG Mob, but I can't get it to follow me, only other monsters?
My Goblin-Monster's Humanoidname = "Human" And the white one's Humanoidname is = "Humanoid"
https://gyazo.com/c8e06fce383a49a01ef82837de9395f1
My Goblin will only follow other "Mobs" with their Humanoid also named "Humanoid", and therefore I'm wondering why it can't follow me? If I get near it is just idling and does nothing?
Anyways here's my "MobManager" script
local Module = require(Game.ServerScriptService.MobFunctions)
local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")
local Debounce = false
local OrigPos = script.Parent.Torso.Position
LinkedSword = nil
TicksUntilWander = 0
script.Parent.Name = script.Parent.SETTINGS.MobName.Value .. " [" .. script.Parent.SETTINGS.Lvl.Value.. "]"
script.Parent.Human.Health = script.Parent.Human.MaxHealth
--Damage on hit.
function DamagePlayer(Hit)
if Hit.Parent:FindFirstChild("Humanoid") ~= nil and script.Parent.Human.Health > 0 then
if Debounce == false then
Debounce = true
Module.AttackPlayer(script.Parent, Hit.Parent:FindFirstChild("Humanoid"), script.Parent.SETTINGS.MinDmg.Value, script.Parent.SETTINGS.MaxDmg.Value, script.Parent.SETTINGS.HitChance.Value, script.Parent.SETTINGS.CritChance.Value, script.Parent.SETTINGS.CritMagnitude.Value)
wait(script.Parent.SETTINGS.CooldownMagnitude.Value/100)
Debounce = false
--else print("Debouncing")
end
else
return false
end
end
function RegisterTool(tool)
if tool:IsA("Tool") then
LinkedSword = tool
LinkedSword.Handle.Touched:connect(DamagePlayer)
end
end
larm.Touched:connect(DamagePlayer)
rarm.Touched:connect(DamagePlayer)
script.Parent.ChildAdded:connect(RegisterTool)
--XP and Gold on death.
function Died()
local tag = script.Parent.Human:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local Leaderstats = tag.Value:FindFirstChild("leaderstats")
if script.Parent.SETTINGS:FindFirstChild("XP") ~= nil and script.Parent.SETTINGS:FindFirstChild("Gold") ~= nil then
Module.AddStats(Leaderstats, script.Parent.SETTINGS.XP.Value, script.Parent.SETTINGS.Gold.Value)
else
print("Can't find XP and Gold!")
end
end
end
if script.Parent:FindFirstChild("Model") ~= nil then
if script.Parent.Model:FindFirstChild("Part") ~= nil then
script.Parent.Model:Destroy()
end
end
end
script.Parent.Human.Died:connect(Died)
--Spawn initial part for purpose of returning. The purpose of this is to fix the wander as they move in straight line unintentionally.
if script.Parent:FindFirstChild("Model") == nil then
model = Instance.new("Model", script.Parent)
part = Instance.new("Part", model)
part.Anchored = true
part.CanCollide = false
part.Transparency = 1
part.Position = OrigPos
end
--Follow
function findNearestTorso(pos)
local list = Game.Workspace:GetChildren()
local torso = nil
local dist = script.Parent.SETTINGS.ChaseRange.Value
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:FindFirstChild("Torso")
human = temp2:FindFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and (script.Parent.Torso.Position - OrigPos).magnitude <= script.Parent.SETTINGS.ChaseDistance.Value then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
while true do
wait(0.2)
--Chase
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Human:MoveTo(target.Position, target)
end
--Wander
if TicksUntilWander > 0 then
TicksUntilWander = TicksUntilWander - 1
else
TicksUntilWander = math.random(10, 25)
if target == nil then
if script.Parent:FindFirstChild("Model") ~= nil then
script.Parent.Human:MoveTo(Vector3.new(OrigPos.X + math.random(-script.Parent.SETTINGS.WanderRadius.Value, script.Parent.SETTINGS.WanderRadius.Value), OrigPos.Y, OrigPos.Z + math.random(-script.Parent.SETTINGS.WanderRadius.Value, script.Parent.SETTINGS.WanderRadius.Value)), script.Parent.Model:FindFirstChild("Part"))
end
end
end
end

3 comments
Because the mob test's humanoid is named Humanoid, like yours.. Change the mob test's Humanoid name and I think it should work. Or maybe change the white one's torso name
As said my Humanoidname to the "Testmob" is Humanoid. And still if I remove the Testmob from the game, and nothing is near my "Goblin" except for me, it still wont follow me
https://gyazo.com/ecc324f5b1f988954928006ad714b4f4