So, I’m making a fighting game with weapons, and I want an idle animation for holding the baseball bat.
Here’s my script:
local tool = script.Parent
local anim = tool.Idle
local track
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = true
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
local tool = script.Parent
local anim = Instance.new("Animation")
anim.Name = "IdleAnim"
anim.AnimationId = "rbxassetid://#####" -- Idle animaton ID here
local track
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Movement
track.Looped = true
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)