local SwingAnim = game.workspace.Animations.Swing
local Pluck = game.StarterPack.Pluck
function onTouched(Obj)
local h = Obj.Parent:FindFirstChild("Humanoid")
if h then
h.Health = 0
end
end
script.Parent.Touched:Connect(onTouched)
Pluck.Activated:Connect(function()
print("Swing starts now")
end)
COMMUNITY QUESTION
My script to print something when activate a tool wont work. How do i fix this?
1 answer
So there are a few things wrong with this (what I assume to be) ServerScript. First, you're trying to reference the player's backpack with game.StarterPack. This is a problem because once your game runs everything in StarterPack is copied into the player's Backpack. So you won't really be making any changes to the current tool. To do this just put a LocalScript into the tool and write this:
local tool = script.Parent
tool.Equipped:Connect(function()
tool.Activated:Connect(function()
print("Swing starts now")
end)
end)
1 comment
0
tool.Equipped and toolActivated are the same thing.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Make sure that you have activated the tool while testing.
yes i have activated it
Make sure that the script is a local script