#cooldown

1 messages · Page 1 of 1 (latest)

obsidian ravine
dusk mural
#

add a "debounce check" inside the function that detect user input

#

you could send the code here

cobalt sonnet
#

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)
soft quiverBOT
#

studio** You are now Level 4! **studio

halcyon zephyr
#

wait()

#

ot task.wait()

cobalt sonnet
# obsidian ravine which script?
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)