How my script works is that when the tool is activated it plays an animation, it is for a sword.
I am terrible with animations lol so heres the script!
local tool = script.Parent
local Damage = script.Parent:WaitForChild("DamageAmount").Value
tool.Activated:Connect(function()
local anim = script.Parent:WaitForChild("Slice") local char = script.Parent.Parent local animTrack = char.Humanoid.Animator:LoadAnimation(anim) animTrack:Play() tool:WaitForChild("Sword").Touched:Connect(function(hit) local player = script.Parent.Parent.Name local touched = hit.Parent if touched.Name ~= player then if touched:FindFirstChild("Humanoid") then touched.Humanoid.Health = touched.Humanoid.Health - Damage end end end)
end)
When Loading your animation, you only need to access the humanoid you're playing the animation on.
local animTrack = char.Humanoid.Animator:LoadAnimation(anim)
Should really just be
local animTrack = char.Humanoid:LoadAnimation(anim)
if this doesn't work i apologize, but this should fix ur issue.