Well I’m trying to see if my script works, so that when I click it activates or deactivates but I don’t know what is wrong with my script, anyone could help?
local Tool = script.Parent Tool.Activated(function() print(“I am so happy”) end) Tool.Deactivated(function() print(“awww man I so sad”) end)
Just change a few things..
local Tool = script.Parent Tool.Activated:Connect(function() print(“I am so happy”) end) Tool.Deactivated:Connect(function() print(“awww man I so sad”) end)
You needed to actually connect the event to the function, hints :Connect. Though I've been testing, and that didn't work for me? But, if you run into any problems, use this, the script that worked for me. (this code is a localscript, child of the tool)
local tool = script.Parent function check() if tool.Parent == game.Players.LocalPlayer.Backpack then print("Unequipped!") elseif tool.Parent == game.Players.LocalPlayer.Character then print("Equipped!") end end tool.AncestryChanged:Connect(check)
There you go! 2 ways to do it! Good luck on whatever you're doing!