My touched function hits multiple times even though it was debounce on it kinda confused whats wrong with it can anyone help me out?
local AnimTable = {1}
local db = false
Remotes.Click.OnServerEvent:Connect(function(Player)
if db == false then
if Player.Character.Settings.Weapons.Katana.Value == true then
if Player.Character.Settings.Equiped.Value == true then
db = true
--animations
if AnimTable[1] == 1 then
local Attack1 = Player.Character.Humanoid:LoadAnimation(RepStorage.Animations.Katana.KatanaAttack1)
Attack1:Play(0.2,2,2.5)
AnimTable[1] = 2
else
if AnimTable[1] == 2 then
local Attack2 = Player.Character.Humanoid:LoadAnimation(RepStorage.Animations.Katana.KatanaAttack2)
Attack2:Play(0.2,2,2)
AnimTable[1] = 1
end
end
--damage
local db1 = false
Player.Character.Katana.Touched:Connect(function(touched)
if db1 == false then
db1 = true
touched.Parent.Humanoid:TakeDamage(30)
wait(1)
db1 = false
end
end)
wait(0.3)
db = false
end
end
end
end)