"idle animation when a player is holding a tool"
xxxxxxxxxx
-- local script inside the tool
local tool = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://your_animation_id_here" -- Replace with your animation ID
local animationTrack
local function onEquipped()
local character = tool.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
end
end
local function onUnequipped()
if animationTrack then
animationTrack:Stop()
end
end
tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)