The title says it all! This script below is a script in a tool
local Anim = script:WaitForChild("Animation")
local Hum = script.Parent.Parent.Parent:WaitForChild("Humanoid")
local Dance = Hum:LoadAnimation(Anim)
script.Parent.Activated:Connect(function()
Dance:Play()
end)
Set the animation priority to whatever it fits.
More information: AnimationTrack
Dance.Priority = (whatever you want.)
I should also mention that it is much recommended to use FindFirstChildWhichIsA than FindFirstChild in humanoidsâ case.
The way you should get your humanoid properly is with the LocalPlayer and not script.Parent.Parent⌠etc.
tool.Activated does not run on server scripts so yeah, must be that your mistake.
local anim = script:WaitForChild("Animation")
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local hum = char.Humanoid
local Dance = hum:LoadAnimation(anim)
script.Parent.Activated:Connect(function()
Dance:Play()
end)