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

Custom rig attached to Player's Running animation overrides idle?(GETSTATE)

Asked by 3 years ago

So I have a tendril attached to the player and I'm trying to sync animations with the players movement, Problem IS.. Running State over rides idle even though I have the code listening for MoveDirection and ignoring other states.

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local Anims = RS:FindFirstChild("Animations")
local Player = Players.LocalPlayer
local Settings = {
    Kagunes = {
        KenRinSettings = {
            ["Idle"] = Anims:FindFirstChild("KenRinIdle"),
            ["Running"] = Anims:FindFirstChild("KenRinRunning"),
            ["KagVal"] = script.Parent:FindFirstChild("Kagune").Value,
            ["AnimC"] = script.Parent:FindFirstChild("AnimationController")
        }
    } 
}
if (Player and Player.Character) then
    local Hum = Player.Character:FindFirstChild("Humanoid")
    Hum.StateChanged:Connect(function()
        if Hum.MoveDirection == Vector3.new(0,0,0) and Hum:GetState() ~= Enum.HumanoidStateType.Running and Hum:GetState() ~= Enum.HumanoidStateType.Jumping and Hum:GetState() ~= Enum.HumanoidStateType.Freefall and Settings.Kagunes.KenRinSettings.KagVal == "KenRin" then
            local Anim = Settings.Kagunes.KenRinSettings.AnimC:LoadAnimation(Settings.Kagunes.KenRinSettings.Idle)
            Anim:Play()
        elseif Hum:GetState() == Enum.HumanoidStateType.Running and Hum:GetState() ~= Enum.HumanoidStateType.Jumping and Hum:GetState() ~= Enum.HumanoidStateType.Freefall and Settings.Kagunes.KenRinSettings.KagVal == "KenRin" then
            local Anim = Settings.Kagunes.KenRinSettings.AnimC:LoadAnimation(Settings.Kagunes.KenRinSettings.Running)
            Anim:Play()
        end
    end)
end
0
Below 19: (Settings.Kagunes.KenRinSettings.Idle) Below 22: (Settings.Kagunes.KenRinSettings.Running) KnockOfScripting 0 — 3y

Answer this question