#Animation Plays once

7 messages · Page 1 of 1 (latest)

steep siren
#
local function LoadAnimation(animName, speed)
    local AnimationController = ArmRig:FindFirstChild("AnimationController")
    local GunAnim = WeaponAnims:FindFirstChild(GunRig.Name)
    local anim = GunAnim:FindFirstChild(animName)

    local animToPlay
    if LoadedAnims[animName] then
        animToPlay = LoadedAnims[animName]
    elseif animName and anim then
        local LA = AnimationController:LoadAnimation(anim)
        LoadedAnims[animName] = LA
        animToPlay = LA
        
        animToPlay.Stopped:Connect(function()
            if animName == "Equip" then
                LoadAnimation("Idle")
            end
        end)
    end

    if animToPlay then
        animToPlay:Play(0)
        animToPlay:AdjustSpeed(speed or 1)
        TArms(0)
        return animToPlay
    end
end
glad iris
#

In the Animation Editor, is the Looped property set to true?

formal shoal
#

it’s a load animation bro

steep siren
#
local function LoadAnimation(animName, speed)
    print("[Framework]: LoadAnimation called with animName:", animName, "and speed:", speed)

    local AnimationController = ArmRig:FindFirstChild("AnimationController")
    if not AnimationController then
        warn("[Framework]: AnimationController not found in ArmRig")
        return
    else
        print("[Framework]: AnimationController found")
    end

    local GunAnim = WeaponAnims:FindFirstChild(GunRig.Name)
    if not GunAnim then
        warn("[Framework]: GunAnim not found for", GunRig.Name)
        return
    else
        print("[Framework]: GunAnim found for", GunRig.Name)
    end

    local anim = GunAnim:FindFirstChild(animName)
    if not anim then
        warn("[Framework]: Animation", animName, "not found in GunAnim")
        return
    else
        print("[Framework]: Animation", animName, "found in GunAnim")
    end

    local animToPlay
    if LoadedAnims[animName] then
        animToPlay = LoadedAnims[animName]
        warn("[Framework]: Animation Exist Loading Animation...")
    else
        local LA = AnimationController:LoadAnimation(anim)
        LoadedAnims[animName] = LA
        animToPlay = LA

        warn("[Framework]: Animation Exist not loaded...")
    end

    if animToPlay then
        if animToPlay.IsPlaying then
            print("[Framework]: Animation", animName, "is already playing")
        else
            print("[Framework]: Stopping animation track before playing")
            animToPlay:Stop()  -- Stop the animation track before playing
            animToPlay:Play(0)
            animToPlay:AdjustSpeed(speed or 1)
            animToPlay.Priority = Enum.AnimationPriority.Action
            TArms(0)
            print("[Framework]: Playing animation", animName)
        end
        return animToPlay
    elseif animToPlay and LoadedAnims[animName] then
        warn("[Framework]: Animation Loaded")
    end
end
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa