So I have a script and a local script inside the sword with an attack animation inside the local script.
Script:
local debounce = true -
script.Parent.Touched:Connect(function(p)
local humanoid = p.Parent:FindFirstChild("Humanoid")
if debounce == true and humanoid then
debounce = false
humanoid:TakeDamage(math.random(1,2))
end
end)
Local script:
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local canplay = true
script.Parent.Activated:Connect(function()
local attack = char:WaitForChild("Humanoid"):LoadAnimation(script.Attack)
if canplay == true then
attack:Play()
canplay = false
wait(1)
attack:Stop()
canplay = true
end
end)
So the animation plays only every 1 second but the sword still won't do any damage
1 comment
Check answers