Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

0

its a local script

1 answer

✓ Accepted answer
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.