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

How do I make a script that activates a tool?

For example, the sword will slash when I click? So how do I make a local script that will slash using click for me on client-sided?

1 answer

✓ Accepted answer

To slash a tool, you create a StringValue inside a tool. The StringValue must be named "toolanim". Then set the value to "Slash". And to slash the tool by clicking, simply use Tool.Activated. Tool.Activated fires when you click the screen while holding the tool. Also don't forget that your tool has a handle and RequiresHandle is set to true, otherwise it won't work. Put a script inside the tool and the script should look like this:

local tool = script.Parent
local debounce = false

tool.Activated:Connect(function()
	if not debounce then
		debounce = true
		local value = Instance.new("StringValue", tool)
		value.Name = "toolanim"
		value.Value = "Slash"
		task.wait(1)
		debounce = false
	end
end)

You can also remove debounce if you want. Debounce is like a cooldown when you activate the tool. Hope this helps! #LearnSomethingNewToday

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