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

when i run my game, the animation will not play. why is this happening?

Asked by 4 years ago

basically what i want is so when i equip my tool, it will play the custom equip animation

but it's not working so yea

here's a snippet of the code i dont know how to change the line numbers in this question thing (line 18 to 33)

staff.Equipped:Connect(function()
    --check if the body type is R6 or R15
    if character:FindFirstChild("Lower Torso") then--if the body type is R15
        local equipR15 = Instance.new("Animation")--makes animation instance
        equipR15.AnimationId = "rbxassetid://4967140370"--sets the animation ID
        local equipAnimTrackR15 = hum:LoadAnimation("equipR15")
        equipAnimTrackR15:Play()
    end

    if character:FindFirstChild("Torso") then--if body type is R6
        local equipR6 = Instance.new("Animation")--makes animation instance
        equipR6.AnimationId = "rbxassetid://4967132516"
        local equipAnimTrackR6 = hum:LoadAnimation("equipR6")
        equipAnimTrackR6:Play()
    end
end)

there is nothing in the output pls help

0
are you running on a local script? Diamond_Plus1 50 — 4y
0
yes ProjectInfiniti 192 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Don't use string, just use the animation.

staff.Equipped:Connect(function()
    --check if the body type is R6 or R15
    if character:FindFirstChild("Lower Torso") then--if the body type is R15
        local equipR15 = Instance.new("Animation")--makes animation instance
        equipR15.AnimationId = "rbxassetid://4967140370"--sets the animation ID
        local equipAnimTrackR15 = hum:LoadAnimation(equipR15)--Use name
        equipAnimTrackR15:Play()
    elseif character:FindFirstChild("Torso") then--if body type is R6
        local equipR6 = Instance.new("Animation")--makes animation instance
        equipR6.AnimationId = "rbxassetid://4967132516"
        local equipAnimTrackR6 = hum:LoadAnimation(equipR6)--Use name
        equipAnimTrackR6:Play()
    end
end)

More details:Wiki.

Edit: Btw I shorted the code.

0
thx man ProjectInfiniti 192 — 4y
Ad

Answer this question