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

How do i change walking animation and idle animation for a sword or tool?

Asked by 3 years ago

So what I'm trying to do is make a idle anim and walking anim for a sword and it changes whenever you wield it, but im having trouble switching between when its idle or walking

my script so far

local tool = script.Parent
local Handle = tool:WaitForChild("Handle")

local Equip = tool:WaitForChild("Equip")
local Unequip = tool:WaitForChild("Unequip")
local Slash = tool:WaitForChild("Slash")

local Idle = script:WaitForChild("KatanaIdle")
local otherAnim = script:WaitForChild("KatanaOther")

Equip.OnServerEvent:Connect(function(Player)
    local Character = Player.Character
    local Humanoid = Character:WaitForChild("Humanoid")

    local Animate = Character:WaitForChild("Animate")
    local toolnone = Animate:WaitForChild("toolnone")
    local toolnoneAnim = toolnone:WaitForChild("ToolNoneAnim")
    local regAnim = toolnoneAnim.AnimationId

    Player.Character.Humanoid.Running:Connect(function(speed)
        if speed == 0 then
            toolnoneAnim.AnimationId = Idle.AnimationId
        elseif speed > 0 then
            toolnoneAnim.AnimationId = otherAnim.AnimationId
        end
    end)

end)

Answer this question