Table Problems Again

I have made topics on how to insert this or that in tables here is one insert Name = Value in tables but for me it’s complicated accessing through values or dictionary them has no purpose and one more thing the things I pass literally exists but the module doesn’t say it exists though

Output

Players.FerbZides.PlayerScripts.Aero.Controllers.MeleeWeaponSystemClient:38: invalid argument #3 (string expected, got nil)  -  Client  -  MeleeWeaponSystemClient:38
  15:45:53.378  Stack Begin  -  Studio
  15:45:53.378  Script 'Players.FerbZides.PlayerScripts.Aero.Controllers.MeleeWeaponSystemClient', Line 38 - function ChangeAnimation  -  Studio  -  MeleeWeaponSystemClient:38
  15:45:53.380  Script 'Players.FerbZides.PlayerScripts.Aero.Controllers.MeleeWeaponSystemClient', Line 60  -  Studio  -  MeleeWeaponSystemClient:60
  15:45:53.380  Script 'ReplicatedStorage.Aero.Shared.Signal', Line 121  -  Studio  -  Signal:121
  15:45:53.380  Stack End  -  Studio
  15:45:53.690  working  -  Client  -  MeleeWeaponSystemClient:51

Code

-- Melee Weapon System Client
-- Username
-- December 16, 2020



local MeleeWeaponSystemClient = {}

local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Quad) -- 1 is time

function MeleeWeaponSystemClient:ChangeAnimation(Player, Table)
    -- Table Format
    --[[
        Animations = {
            Hold = "Blah Blah"   
        }
    ]]

    local Character = Player.Character
    local Humanoid = Character.Humanoid

    -- >>: Get the following Things on the Table {"Hold", "Jump", "Run", "Walk"}
    local animateScript = Character.Animate

    -- Animation Variables
    local WalkAnimationId = Table["Walk"]
    local RunAnimationId = Table["Run"]
    local IdleAnimationId = Table["Hold"]
    local JumpAnimationId = Table["Jump"]

    -- >>: Stop the Current Playing Animations from the Humanoid and play yours or ours
    for _, PlayingAnimations in pairs(Humanoid:GetPlayingAnimationTracks()) do
        PlayingAnimations:Stop()
    end

    animateScript.run.RunAnim.AnimationId = RunAnimationId        -- Run
	animateScript.walk.WalkAnim.AnimationId = WalkAnimationId      -- Walk
	animateScript.jump.JumpAnim.AnimationId = JumpAnimationId      -- Jump
	animateScript.idle.Animation1.AnimationId = IdleAnimationId    -- Idle (Variation 1)
	animateScript.idle.Animation2.AnimationId = IdleAnimationId   -- Idle (Variation 2)
end

function MeleeWeaponSystemClient:Start()
    local Player = game.Players.LocalPlayer

    local MeleeWeaponSystem = self.Services.MeleeWeaponSystem
    -- worst problem ever
    MeleeWeaponSystem.PlayAnimation:Connect(function(Condition, AnimationsFolder)
        print("working")
        if Condition == true then
            local ThisTable = {}

            -- Play Animations
            for AnimationName, AnimationObject in pairs(AnimationsFolder:GetChildren()) do
                local ObjectName = AnimationName
                ThisTable[ObjectName] = AnimationObject.AnimationId

                MeleeWeaponSystemClient:ChangeAnimation(Player, ThisTable)
            end
        elseif Condition == false then
            local ThisTable = {}

            -- Play Animations
            for AnimationName, AnimationObject in pairs(AnimationsFolder:GetChildren()) do
                local ObjectName = AnimationName

                table.insert(ThisTable, ObjectName)

                ThisTable[ObjectName] = AnimationObject.AnimationId

                MeleeWeaponSystemClient:ChangeAnimation(Player, ThisTable)
            end
        end
    end)

    MeleeWeaponSystem.ShowUI:Connect(function()
        local UIObject = MeleeWeaponSystem.DamageUI

        local ClonedDamagedUI = UIObject:Clone()
        ClonedDamagedUI.Parent = HitPart
        ClonedDamagedUI.Adornee = HitPart
        
        local DamageText = ClonedDamagedUI.DamageText
        DamageText.Text = AbbreviationModule:Abbreviate(CurrentDamage)
        
        -- here is where you fade the text out.
        local UITween = TweenService:Create(DamageText, tweenInfo, {TextTransparency = 1; TextStrokeTransparency = 1;})
        
        UITween:Play()
        UITween.Completed:wait()
        
        ClonedDamagedUI:Destroy()
    end)
end

function MeleeWeaponSystemClient:Init()

end

return MeleeWeaponSystemClient

been debugging these for literally minutes now and none of the solutions worked though

In fact now it is fixed I meet this interesting issue here

 Invalid animation id '<error: unknown AssetId protocol>':   -  Client  -  Animate:186
  16:33:11.800  Stack Begin  -  Studio
  16:33:11.800  Script 'Workspace.FerbZides.Animate', Line 186 - function configureAnimationSet  -  Studio  -  Animate:186
  16:33:11.800  Script 'Workspace.FerbZides.Animate', Line 162  -  Studio  -  Animate:162
  16:33:11.800  Stack End  -  Studio

the solution I did btw was to do tostring(AnimationId)

I do not want this error issue popping up at my output

edit: basically the tostringed values will load a couple of seconds and if the couple of seconds were not passed it will error please help I need this weapon system to be finished at December 18

The error says it all, try printing the asset id before assigning it to see what the string really is. Seems like you stored the wrong assetid. The id you see in the library is not the same as the asset’s.

is that true when I exported the animations they had the same id

It’s important to remember the URL is not the same as the content ID. It will work when pasted directly into the AnimationId property of an Animation in Roblox studio, as Studio will automatically correct it, however if it is being set from a Script then the correct content ID will need to be used

content ID on the website is the same as content ID in studio but simplified and I even tried debugging it and prints just fine the error is just setting the animation ID’s

content id is not the same as asset id. just copy paste the content id into a sound instance and it should autoconvert

but they do have the same ID though

did you put “rbxassetid://” before the id

yes and even converted it into a string but now it takes time to load and if you look at the code before the string conversion then you would know that animation id from animation tracks don’t accept non-string values

Just to clarify, does the script ever work, or does it always fail to load the asset?

Can you give a link to the library page, as well as paste the asset id you’re using in your script?

Asset Id’s from Site:

https://www.roblox.com/library/6012503860/Wooden-Sword-Jump
https://www.roblox.com/library/6012455420/Wooden-Sword-Movement
https://www.roblox.com/library/5991049684/Wooden-Swing

Asset Id’s from Studio:

rbxassetid://6012503860
rbxassetid://6012455420
rbxassetid://5991049684

Weirdly enough, it seems to load “properly” for me (it replaces the default walking animation with a blank standing pose since I don’t own the asset). My only guess is that the animation itself might be broken.

Try opening the animation editor and opening Import>From Roblox. In the list, click on the animations in question, but don’t open them. The true asset id should be shown at the bottom of the window.

If the asset id is truly correct, then you could try importing each of the animations. If they load correctly, then it means it’s some kind of a bug in Studio or Roblox itself.

Try creating a new place that replaces the default character animations with these 3 animations (walk+run, jump and idle). Try playing the place in Studio. If it doesn’t work, try exporting it and playing it from the browser. Also, to pinpoint which animation of the 3 is broken, wrap each line that sets the animation id in a pcall and print the returned values. That way, all 3 animations will attempt to load, and will print true and the error message.

Here’s a little script to test this. Place it in StarterCharacterScripts.
LocalScript.rbxm (10.0 KB)

well actually if I just set the animation Id’s with strings manually set-up it seems like it isn’t bugging here is an example

Animate.run.RunAnimation.AnimationId = "rbxassetid://..."

Literally my only guess is you could try loading all of your custom animations as default animations, then playing their animation tracks when needed. It is well known that Roblox’s animations are broken as hell, but this is just silly.