Click to Pickup

Click to Pickup

Where to put this script

Script

local tool = script.Parent.Parent

local click = script.Parent.ClickDetector


local function pickup(player)

tool.Parent = game.Workspace[player.Name]

end


click.MouseClick:Connect(pickup)

Click to Equip Only

  • Rename the Handle part of the tool to "Part"

  • Put the Script below inside the "Part" of the tool

local tool = script.Parent.Parent

local click = script.Parent.ClickDetector


local function pickup(player)

tool.Part.Name = 'Handle'

tool.Parent = game.Workspace[player.Name]

end


click.MouseClick:Connect(pickup)

Alternate Method

local tool = script.Parent

local click = tool.Main.ClickDetector


local ServerStorage = game:GetService('ServerStorage')

local toolsFolder = ServerStorage:WaitForChild('Tools')


local function giveTool(player)

local newTool = toolsFolder[tool.Name]:Clone()

newTool.Handle.Anchored = false

newTool.Parent = player.Backpack

end


click.MouseClick:Connect(giveTool)

Alternate Method (Only One)

local tool = script.Parent

local click = tool.Main.ClickDetector


local ServerStorage = game:GetService('ServerStorage')

local toolsFolder = ServerStorage:WaitForChild('Tools')


local function giveTool(player)

local inPack = player.Backpack:FindFirstChild(tool.Name)

local inHand = player.Character:FindFirstChild(tool.Name)

if not (inPack or inHand) then

local newTool = toolsFolder[tool.Name]:Clone()

newTool.Handle.Anchored = false

newTool.Parent = player.Backpack

end

end


click.MouseClick:Connect(giveTool)