#cooldown
1 messages · Page 1 of 1 (latest)
add a "debounce check" inside the function that detect user input
you could send the code here
something like
local enable = true
UserInputService.InputBegan:Connect(Fucntion(input, gamep)
if input.Userinputtype == Enum.Userinputtype.MouseButton1 then
if enable == true then
enable = false
task.wait(2)
enable = true
end
end
end)
which script?
** You are now Level 4! **
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Events = ReplicatedStorage.Events
local AttackHitBoxes = require(script.Parent.AttackHitBoxes)
local ClickAttackDebounces = {}
local enable = true
Events.ClickAttack.OnServerEvent:Connect(function(Player)
local Character = Player.Character
if Character == nil then
return
end
if enable == true then
task.spawn(function()
enable = true
task.wait(2)
enable = false
end)
else
return
end
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid == nil then
return
end
if Humanoid.Health <= 0 then
return
end
ClickAttackDebounces[Player] = true
local PunchCombo = Player.Values.PunchCombo
local Animation = script.PunchAnimationCycle[tostring(PunchCombo.Value)]
local LoadedPunchAnimation = Humanoid.Animator:LoadAnimation(Animation)
LoadedPunchAnimation:Play()
if PunchCombo.Value >= #script.PunchAnimationCycle:GetChildren() then
PunchCombo.Value = 1
else
PunchCombo.Value += 1
end
AttackHitBoxes.CreateHitbox(Character, Vector3.new(9, 9, 5), 10, true)
task.wait(LoadedPunchAnimation.Length - 0.1)
if ClickAttackDebounces[Player] then
ClickAttackDebounces[Player] = nil
end
end)
alright thanks
local script right?