So like, if I clicked a certain brick, the tool would go onto it, and then if I clicked it again, I would pick it back up again.
COMMUNITY QUESTION
How do I make a tool go onto a certain brick on click?
1 answer
You could do this with ClickDetectors.
For example, you could have a ClickDetector in the brick. There would be a script in that brick that would put the tool onto the brick, and a ClickDetector in the tool, and weld the tool to the brick, then detect when the tool is clicked and give it back to a player... Here, let me use an example:
local hasTool = false
local function setupTool(tool)
hasTool = true
tool.Parent = script.Parent
local clickDetector = script.Parent.ClickDetector:Clone()
clickDetector.Parent = tool
local handle = tool:FindFirstChild('Handle')
local toolWeld = Instance.new('Weld', tool.Handle)
toolWeld.Part0 = handle
toolWeld.Part1 = script.Parent
toolWeld.C0 = CFrame.new(0, -1, 0)
clickDetector.MouseClick:Connect(function(plr)
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character and character:FindFirstChildWhichIsA('Humanoid')
local backpack = plr:FindFirstChild('Backpack')
if not humanoid or not backpack then return end
toolWeld:Destroy()
clickDetector:Destroy()
hasTool = false
tool.Parent = backpack
humanoid:EquipTool(tool)
end)
end
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
if hasTool then return end
local character = plr.Character
if not character then return end
local humanoid = character:FindFirstChildWhichIsA('Humanoid')
local tool = character:FindFirstChildWhichIsA('Tool')
local handle = tool and tool:FindFirstChild('Handle')
if not humanoid or not handle then return end
humanoid:UnequipTools()
setupTool(tool)
end)
This is untested, I'd substitute the CFrame for C0 with something else, and it'll get messed up if you touch the tool to automatically pick it up again, but it could probably work.
Hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Great answer! next time don't write a Script they can take and leave;)
Wait, how do I weld a tool to a brick? Sorry, I'm new to scripting.
Look in the code, around ToolWeld. That creates a weld between the part and the Handle, and sets the offset (C0).
@Feahren I intentionally don't test the scripts I post here