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

How would you make trails on a sword that will only activate when the player attacks?

1 answer

✓ Accepted answer

If you check the Roblox API you can get some very useful information!

As a refference to your question we have this link:

http://wiki.roblox.com/index.php?title=API:Class/Tool

If you actually check the Events section of the Tool you can see it has this:

Activated ( ) : Fired when the player clicks while a tool is equipped.

You definetly should be able to find it and figure it out by yourself now!

local plr = game.Players.LocalPlayer
local bp = plr:WaitForChild("Backpack");
local ReplicatedHolder = game:GetService("ReplicatedStorage");

local exampleTool = ReplicatedHolder:WaitForChild("Tool");
exampleTool.Parent = bp;

exampleTool.Activated:Connect(function()
	print("Woohoo");
	-- Example Code
end)

Take care that its important that your weapon has a handle or not. The local script might work or not depending if your weapon has a handle or not & if you allow your tool to have a handle.

Hope this helps you, ask anything if you still have not understood it fully.

1 comment

0

Thank you.

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