local tool = script.Parent
local animation = tool:FindFirstChild("swing") -- Make sure this exists and has AnimationId set!
tool.Activated:Connect(function()
local character = tool.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid and animation then
print(character.Name .. ' swinged his sword')
local track = humanoid:LoadAnimation(animation)
track:Play()
else
warn('No humanoid or animation found!')
end
end)