Script to Retrieve Tool When Clicked

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.

if script.Parent.Owner.Value == plr then
local a = game.ServerStorage[“TOOL”]:Clone()
a.Parent = plr.Backpack
if p == script.Parent.Owner.Value then

Place a ClickDetector in the Handle of the tool.

Then create a Script inside the tool -

local tool = script.Parent;
local cd = tool:FindFirstChild("ClickDetector");

    tool.Parent = plr.Backpack;

Mhm, but let me tell you this.

The part that is placed on click is inside of server storage. It has a click detector, and that is the code.

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

I don’t find a need to put the tool inside Server Storage then cloning it since you are anyways destroyed the tool on the ground after its clicked.

Also you can add a few lines of code if the player is by chance clicking the Tool’s Handle when its equipped.

Using -

if plr.Character:FindFirstChild("ToolName") then

No no, the part that is placed is in it, not the tool.

Refer to this: image

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.

Do you happen to have discord so I can screenshare this and make it easier?

I think you’re confused right now.

Nevermind, I was confused, thank you!!

1 Like