Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

1 answer

Log in to vote
0
Answered by 6 years ago

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.

0
Thank you. HypedNebula 28 — 6y
Ad

Answer this question