I am trying to make a sword but my script for animating the Attacks does not work unlike the video i was watching to make the script
This is the script:
local tool = script.Parent
local cooldown = script.Cooldown.Value
local animation = script.Swing
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChildWhichIsA('Humanoid')
if humanoid and cooldown == false then
cooldown = true
local playanim = humanoid:LoadAnimation(animation)
playanim:Play()
wait (0.24)
playanim:Stop()
wait (0.2)
cooldown = false
end
end)
the video is this: