Advertisement
OnFireRobloxScriptin

Multiplayer Pick Up Tool Script (Click)

Aug 5th, 2024
587
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. --//Variables
  2. local tool = script.Parent.Parent --Variable for the tool
  3. local clickdetector = tool.ClickDetector --Variable for the click detector
  4.  
  5. --//Pick up
  6. clickdetector.MouseClick:Connect(function(player) --When the click detector is clicked
  7.     local char = player.Character --Variable for the player's character
  8.     if not char:FindFirstChild(tool.Name) then --Check for tool inside character
  9.         if not player.Backpack:FindFirstChild(tool.Name) then --Check for tool inside character's backpack
  10.             local newtool = tool:Clone() --IF checks passed then clone the tool
  11.             newtool:WaitForChild("ClickDetector"):Destroy() --Destory the click detector in the new tool
  12.             newtool.Parent = player.Backpack --Put tool inside the player's backpack
  13.         end
  14.     end
  15. end)
Advertisement
Comments
  • # text 0.16 KB | 0 0
    1. This is vulnerable to exploiters who can parent the tool to their character or backpack (bypassing the unable to be picked up property), essentially breaking it :(
Add Comment
Please, Sign In to add comment
Advertisement