Hello, I am trying to make a tool so when it’s placed and you click it, it goes back to your inventory as a tool. The current code I am utilizing is not working properly. There is also an “Owner” value.
Code:
script.Parent.ClickDetector.MouseClick:connect(function(plr)
if script.Parent.Owner.Value == plr then
local a = game.ServerStorage[“TOOL”]:Clone()
a.Parent = plr.Backpack
script.Parent:Destroy()
end
end)
game.Players.PlayerRemoving:connect(function(p)
if p == script.Parent.Owner.Value then
script.Parent.Parent:Destroy()
end
end)
The script also has to have an Owner value or some sort of thing to indicate who placed and random people can’t just pick it up, only the specific person who placed it can
Instead of a having a different part to click. I believe you can just stick the ClickDetector inside the handle. And if thats the case. Then you can simply place SpikeStrip inside the tool and then weld it to the handle.