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

why does my Idle animation for my Sword won't play?

Asked by 2 years ago
Edited 2 years ago

Script:

local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationID = "http://www.roblox.com/Asset?ID=8490330226"
local track

tool.Equipped:Connect(function()
    track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
    track.Priority = Enum.AnimationPriority.Action
    track:Play()
end)

tool.Unequipped:Connect(function()
    if track then
        track:Stop()
    end
end)
0
its a local script Exonl_Roblox 2 — 2y

1 answer

Log in to vote
0
Answered by
imKlevi 94
2 years ago
Edited 2 years ago
local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://8490330226"
local track
local player = game.Players.LocalPlayer

tool.Equipped:Connect(function()
    track = player.Character.Humanoid:LoadAnimation(anim)
    track.Looped = true
    track.Priority = Enum.AnimationPriority.Action
    track:Play()
end)

tool.Unequipped:Connect(function()
    if track then
        track:Stop()
    end
end)
Ad

Answer this question