Advertisement
Guest User

toolHandler

a guest
Sep 16th, 2018
11,877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. --[[
  2.  
  3. Want an explanation of the script? ٩(。•́‿•̀。)۶
  4. https://youtu.be/LtQmj3YgLnE (Shirooo)
  5.    
  6. --]]
  7.  
  8. local re = Instance.new("RemoteEvent")
  9. re.Parent = game:GetService("ReplicatedStorage")
  10. re.Name = "toolEvent"
  11.  
  12. re.OnServerEvent:Connect(function(plr, tool)
  13.     local mag = (tool:WaitForChild("Handle").Position - plr.Character.HumanoidRootPart.Position).magnitude
  14.    
  15.     if mag < 5 then
  16.         tool.Parent = plr.Backpack
  17.     end
  18. end)
  19.  
  20. function untouch(list)
  21.     for i = 1, #list do
  22.         local handle = list[i]:WaitForChild("Handle")
  23.         if handle then
  24.             local ti = handle:FindFirstChild("antiTouch") -- <
  25.             if not ti then
  26.                 local clone = script.antiTouch:Clone() -- <
  27.                 clone.Parent = handle
  28.                 clone.Disabled = false
  29.             end
  30.         end
  31.     end
  32. end
  33.  
  34. local tools = workspace:WaitForChild("tools"):GetChildren()
  35. untouch(tools)
  36.  
  37. workspace.tools.ChildAdded:Connect(function(child)
  38.     untouch({child})
  39. end)
  40.  
  41. workspace.ChildAdded:Connect(function(child)
  42.     if child:IsA("Tool") then
  43.         wait()
  44.         child.Parent = workspace.tools
  45.     end
  46. end)
  47.  
  48. --[[ Shiro75 ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement