Scripting Helpers is winding down operations and is now read-only. More info→
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 1 year 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 — 1y
0
Didn't work :/ LiamQ926 7 — 1y
0
Check the R15 and R6 Animations IDs SuperPuiu 497 — 1y
0
I fixed it LiamQ926 7 — 1y

Answer this question