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)

1 comment
It does not work. I have already done this before and it didnt work because somebody told me it was deprecated.