I am currently trying to make a RPG game from scratch, however every time I playtest the game, the mob I have created wont animate. All code is in the same two scripts, a module for functions and a server script for calling and base setup.
My code here has the mob follow a player, and if the player moves out of range it will stop following:
while task.wait(0.05) do
if Config.MobCurrentlyFollowing ~= nil then
local Player = Config.MobCurrentlyFollowing
if Player.Character then
local Hum = Player.Character:FindFirstChild("Humanoid")
local humRoot = Player.Character:FindFirstChild("HumanoidRootPart")
if Hum and humRoot then
if Hum.Health > 0 then
if script.Parent.PrimaryPart:GetNetworkOwner() ~= Player then
script.Parent.PrimaryPart:SetNetworkOwner(Player)
end
local LoadAnim = Config:LoadAnimation(script.Parent.AI.Animator, script.Parent.AI.Animator.Walk)
LoadAnim.Looped = true
LoadAnim:Play()
script.Parent.AI:MoveTo(humRoot.Position + (humRoot.CFrame.LookVector * (Config.MobAttackRange / 2)))
end
end
end
else
local LoadAnim = Config:LoadAnimation(script.Parent.AI.Animator, script.Parent.AI.Animator.Idle)
LoadAnim.Looped = true
LoadAnim:Play()
end
end
The function to load the animations just returns Animator:LoadAnimation(Animation)
Despite my attempts of different way to, I seem unable to get the mob to animate. Any help?
P.S If its not clear the mobs humanoid is called AI instead of Humanoid

1 comment
Lol