Advertisement
OnFireRobloxScriptin

Multiplayer Pick Up Tool Script (Press E)

Jun 13th, 2024 (edited)
1,623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. --//Variables
  2. local prox = script.Parent --Variable for proximity prompt
  3. local tool = prox.Parent.Parent --Variable for tool
  4.  
  5. --//Pick up
  6. prox.Triggered:Connect(function(player) --When proximity prompt is triggered
  7.     local char = player.Character --Variable for 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 are passed then clone the tool
  11.             newtool:WaitForChild("Handle"):WaitForChild("ProximityPrompt"):Destroy() --Destroy current proximity prompt inside tool
  12.             newtool.Parent = player.Backpack --Put tool inside player's backpack
  13.         end
  14.     end
  15. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement