Ad
Log in to vote
0

Claymore tool doesn't appear to print anything, double clicked or not (?)

Asked by 4 months ago

As the title says, Im trying to make a claymore that has a lunge attack when double clicked, when simply clicked once, It simply slashes, I am new at making tools that has a double click feature, and when (double) clicked It prints out nothing

Script:

local tool = script.Parent
local CanDoubleClickBoolValue = tool.CanDoubleClick
local Timer = 0.3
local Boolens = {
    Debounce = false
}

tool.Activated:Connect(function()
    if not Boolens.Debounce then
        Boolens.Debounce = true
        print("The tool has been clicked")
        CanDoubleClickBoolValue.Value = true
        if tool.Activated == true and CanDoubleClickBoolValue.Value == true and Timer <= 0 then
            print("The tool has been double clicked")
            CanDoubleClickBoolValue.Value = false
        end
        wait(Timer)
        CanDoubleClickBoolValue.Value = false
    end
end)

1 answer

Log in to vote
1
Answered by 4 months ago
Edited 4 months ago
local tool = script.Parent
local CanDoubleClickBoolValue = tool:WaitForChild("CanDoubleClick")
local Timer = 0.3
local Boolens = {
    Debounce = false
}

tool.Activated:Connect(function()
    if not Boolens.Debounce then
        Boolens.Debounce = true
        print("The tool has been clicked")
        CanDoubleClickBoolValue.Value = true
        wait(Timer)
        Boolens.Debounce = false
        CanDoubleClickBoolValue.Value = false
    elseif Boolens.Debounce and CanDoubleClickBoolValue.Value then
        print("The tool has been Double clicked")
    end
end)
Ad

Answer this question