Ad
Log in to vote
0

I'm getting a "LoadAnimation requires the asset id to not be empty" Error can someone please help?

Asked by 3 months ago
local rp = game:GetService("ReplicatedStorage")
local Sword = rp:WaitForChild("Sword")

local cframes = {
    ["Right Arm"] = CFrame.new(0,-1,0),
    ["RightHand"] = CFrame.new(0,0,0)
}

Sword.OnServerEvent:Connect(function(Player,isEquipped)
    local Character = Player.Character
    local Humanoid = Character.Humanoid

    if isEquipped then
        --Equipping the sword
        local equipAnim
        if Humanoid.RigType == Enum.HumanoidRigType.R15 then
            equipAnim = Humanoid.Animator:LoadAnimation(script.R15.Equip) -- Error
        elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
            equipAnim = Humanoid.Animator:LoadAnimation(script.R6.Equip) -- Error
        end
        equipAnim:Play()

        local Katana = Character:FindFirstChild("Katana")
        if Katana then
            local SideWeld = Katana.PrimaryPart:FindFirstChild("SideWeld")
            if SideWeld then
                SideWeld:Destroy()

                if Humanoid.RigType == Enum.HumanoidRigType.R15 then
                    Katana:SetPrimaryPartCFrame(Character:WaitForChild("RightHand").CFrame * cframes.RightHand)

                elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
                    Katana:SetPrimaryPartCFrame(Character:WaitForChild("Right Arm").CFrame * cframes["Right Arm"])

                end

                local HandWeld = Instance.new("ManualWeld")
                HandWeld.Name = "HandWeld"
                HandWeld.Part0 = Katana.PrimaryPart

                if Humanoid.RigType == Enum.HumanoidRigType.R15 then
                    HandWeld.Part1 = Character:WaitForChild("RightHand")

                elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
                    HandWeld.Part1 = Character:WaitForChild("Right Arm")
                end

                HandWeld.C0 = HandWeld.Part0.CFrame:ToObjectSpace(HandWeld.Part1.CFrame)
                HandWeld.Parent = HandWeld.Part0

            end
        end
    elseif not isEquipped then
        --Unequipping the sword
        local Katana = Character:FindFirstChild("Katana")
        if Katana then
            local Handweld = Katana.PrimaryPart:FindFirstChild("HandWeld")
            if Handweld then
                Handweld:Destroy()

                local Case = Character:FindFirstChild("Case")
                if Case then
                    Katana:SetPrimaryPartCFrame(Case.Case.CFrame * CFrame.new(0,-.125,2.65))

                    local weld2 = Instance.new("ManualWeld")
                    weld2.Name = "SideWeld"
                    weld2.Part0 = Katana.PrimaryPart
                    weld2.Part1 = Case.PrimaryPart
                    weld2.C0 = weld2.Part0.CFrame:ToObjectSpace(weld2.part1.CFrame)
                    weld2.Parent = weld2.Part0

                    Sword:FireClient(Player)
                end
            end
        end
    end

end)
0
You dont need animator.[maybe] horvathmf 10 — 3mo
0
Didn't work :/ LiamQ926 4 — 3mo
0
Check the R15 and R6 Animations IDs SuperPuiu 482 — 3mo
0
I fixed it LiamQ926 4 — 3mo

Answer this question