How do I disable the ability to pick up tools when you walk over them?

How do I disable the ability to pick up tools when you walk over them?

I would just like it so the tool wouldn’t get picked up when I walk over it

When I delete the touch interest from the tool, it gets spawned in when I drop it

happy to hear your help :slight_smile:

7 Likes

Look at this post! The solution of this post is saying to use this script!:

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:wait()

local Tools = {}

for I, v in pairs(Player.Backpack:GetChildren()) do
     Tools[v] = true
end

Char.ChildAdded:connect(function(Obj)
     if Obj:IsA(“Tool”) and not Tools[Obj] then
          Tools[Obj] = true
          Tool.Parent = Player.Backpack
     end
end)

(also this should probably be in #help-and-feedback:scripting-support , lol.)

1 Like

I’ve created a response for a topic similar to this but in regards to accessories. Follow its principles (as in, just change accessory to tool) and you should be set.

2 Likes

Hi, I’m not trying to disable equipping when a tool is picked up, I would just like it so the tool wouldn’t get picked up when I walk over it?

4 Likes

I’ve tried deleting the intreset before starting/testing the game, but it keeps getting added to the game when I drop it?

1 Like

As I remember, tools get equipped only when you touch the Handle part. Try to rename it and rename it back when you will need to equip it.
If you don’t understand what I mean:

tool.Handle.Name = "Part" --that ability disabled
tool.Part.Name = "Handle" --that ability is enabled
10 Likes

Make a script and put the following code into it:

script.Parent:WaitForChild("TouchInterest"):Destroy()

Then put that script inside the Handle of your tool. What will happen is that it removes the element that let’s you pick the tool up when walking on it.

7 Likes

Add a script in the tool like this

local Parent - script.Parent

Parent.ChildAdded:Connect(function(Child)
	if Child:IsA("TouchInterest") then
		Child:Destroy()
	end
end)

This creates an event that will wait for a child to be added to the tool model (note: make this script a child of the tool or adjust the Parent value accordingly) and will remove any touch interest that is automatically added.

2 Likes

I tried implementing this but for some reason I couldn’t get it to work, happy to hear further help from you.

My current code:

image

It keeps adding a new TouchInterest when I change the parent of it to something in the workspace, so it’s pretty useless. :confused: (Didn’t work)

1 Like

I have tried your code, but altered it a bit because your code wouldn’t work before so my code:

and put this inside of the Handle and I got this error: (Didn’t work)

image

1 Like

It states that you’re trying to set it’s parent to NULL (what Destroy internally does) while it’s setting the Parent to Handle.

Maybe try adding a wait() before you Destroy it?

Why don’t you just disable the drop tool option and place a non tool version of the tool somewhere?

Can you please paste your code here, formatting it like this? Thanks.
Capture

And tool cannot be equipped if it doesn’t have a part named “Handle”. I tried this myself. There’s probably an error in your code somewhere (such as renaming the part from the client, that never works).

Try to loop it with this code:

while true do
wait()
script.Parent:WaitForChild("TouchInterest"):Destroy()
end
4 Likes

Yes waiting for it does work thanks man!

2 Likes

Old post but if someone looking for a solution you can try this.
Consider having a condition of why a tool is not Pickable. Let’s say we have a gun, the gun cannot be pick up if the player is not on Red Team.

Sample
[Tool]
image

local teams = game:GetService("Teams)
local tool = script.Parent
local pickUp
pickUp = tool.Disable.Touched:Connect(function(otherPart)
		local char = p.Parent
		local humanoid = char:FindFirstChild("Humanoid")
		if humanoid then
              local player = game.Players:GetPlayerFromCharacter(char)
              if player.Team == teams.Red then
			       tool.Disable.Name = "Handle"
			       tool.Parent = char
			       pickUp:Disconnect()
              end
		end
	end
end)

Hope it helps :smiley:

2 Likes

Disable CanTouch on the handle

14 Likes

You just need to disable CanTouch on the tool’s handle part.

4 Likes

Disable CanTouch on the handle

8 Likes