Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is stopping my animations from playing?

Asked by 2 years ago

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

2 answers

Log in to vote
0
Answered by 2 years ago

Ok nevermind. Turns out the script itself was fine and it was how i had the rigged mob setup.

0
Lol MattVSNNL 620 — 2y
Ad
Log in to vote
-1
Answered by
enes223 327 Moderation Voter
2 years ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question