Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.