How to make a script where the player who clicked on the tool will make the tool to go to his backpack?
function OnClick(Clicker)
print("The player who clicked is named: " .. Clicker.Name)
script.Parent:Clone().Parent = game.Players.LocalPlayer.BackPack
script.Parent:Destroy()
end script.Parent.ClickDetector.MouseClick:connect(OnClick)
Add a ClickDetector into the handle of the tool along with this script.
script.Parent.Parent.ClickDetector.MouseClick:connect(function() for _, v in pairs(game.Players:GetPlayers()) do print("The player who clicked is named: " .. v.Name) script.Parent.Parent:Clone().Parent = v.Backpack script.Parent.Parent:Destroy() end end)