#Animation doesn't stop playing with attack cooldown

1 messages · Page 1 of 1 (latest)

earnest wave
#

this is my script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local ClientAnimator = ReplicatedStorage.Remotes.ClientAnimator
local Replicator = ReplicatedStorage.Remotes.Replicator
local CombatRemote = ReplicatedStorage.Remotes.CombatRemote
local attackCooldown= false

local Animation = ReplicatedStorage.Animations

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local tracks = {}
for i = 1,4 do
local a = Animation:FindFirstChild("M"..i)
tracks[i] = character:WaitForChild("Humanoid"):LoadAnimation(a)
end

UserInputService.InputBegan:Connect(function(input, gp)
if gp then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 and attackCooldown == false then
attackCooldown = true
task.delay(.5,function()
attackCooldown = false
end)
CombatRemote:FireServer()
end
end)

ClientAnimator.OnClientEvent:Connect(function(combo)
local t = tracks[combo]
if t then t:Play() end
end)

Replicator.OnClientEvent:Connect(function(hrp:Part)
local VFX = game.ReplicatedStorage.VFX.HitVFX.Attachment:Clone()
VFX.Parent = hrp
game.Debris:AddItem(VFX,2)
for i,v in VFX:GetChildren() do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
local part = script.Parent
local safeColor = BrickColor.Blue()
local debounce = false

    end
end

local sound = game.ReplicatedStorage.Sounds.FistHit:Clone()
sound.Parent = hrp
sound:Play()
game.Debris:AddItem(sound,2)

end)
but once the attack cooldown is active the animations keep playing and i dont want that how do i fix?

dense dockBOT
#

studio** You are now Level 1! **studio