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

Tool.Activated is not working at all?

Asked by 2 years ago

So Tool.Activated is not working at all here is the script:

local Tool1 = game.StarterPack.Tool1

Tool1.Activated:Connect(function() print("Hello") end)

But it doesnt work in a local script or a server script i honestly have no idea whats happening

2 answers

Log in to vote
1
Answered by 2 years ago

You are not referencing the tool that is in the player's backpack.
For this to work, the code should look something like this:

-- LocalScript
local Player = game:GetService("Players").LocalPlayer
local Backpack = player.Backpack
local Tool1 = Backpack.Tool1

Tool1.Activated:Connect(function()
    print("Hello")
end)
0
thanks!!! iamnotcool235_s 27 — 2y
0
No problem! ROMAHKAO 35 — 2y
0
wait its not working and im in a local script and i copied it and everything iamnotcool235_s 27 — 2y
0
and its not giving me any errors iamnotcool235_s 27 — 2y
View all comments (4 more)
0
This is definitely a solution, though you can also just put the script(s) in a tool, or if you wanted to be fancy do a for loop and reference all of them through one script! Antelear 185 — 2y
0
the backpack script isnt working and i cant use script.Parent because i am trying to get the tool from a differenent part is there another way iamnotcool235_s 27 — 2y
0
Get the path to the tool. ROMAHKAO 35 — 2y
0
How??? iamnotcool235_s 27 — 2y
Ad
Log in to vote
0
Answered by
Antelear 185
2 years ago

Even if this is already answered, I don't recommend getting it from the backpack! If you really wanted to just put the script inside of the tool in the StarterPack folder. What it does is it will clone the tools inside and put it inside the player's backpack, which is useful if you don't want to do multiple :WaitForChild()s. Just thought I'd put it out there for you, don't be afraid to put local scripts INSIDE your tools!

Answer this question