Advertisement
ZOUK_AG

ToolGui Scripts

Jun 1st, 2020
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. --[[
  2.  
  3. ZOUK AG Youtube
  4.  
  5. --]]
  6.  
  7. local uis = game:GetService("UserInputService")
  8. local rs = game:GetService("ReplicatedStorage")
  9. local event = rs:WaitForChild("toolEvent") -- <
  10.  
  11. local plr = game.Players.LocalPlayer
  12. local kg = plr.PlayerGui:WaitForChild("keyGui")
  13. local char = plr.Character
  14.  
  15. function search()
  16. local tools = workspace:WaitForChild("tools"):GetChildren()
  17. local min = nil
  18. local tool = nil
  19.  
  20. for i = 1, #tools do
  21. local handle = tools[i]:FindFirstChild("Handle")
  22. if handle then
  23. local mag = (char.HumanoidRootPart.Position-handle.Position).magnitude
  24. if min == nil or mag < min then
  25. min = mag
  26. tool = tools[i]
  27. end
  28. end
  29. end
  30.  
  31. if min then
  32. if min < 5 then
  33. return tool
  34. end
  35. end
  36. end
  37.  
  38. uis.InputBegan:Connect(function(input, gameProcessed)
  39. if input.UserInputType.Name == "Keyboard" and gameProcessed == false then
  40. if input.KeyCode.Name == "Q" then
  41. local tool = search()
  42. if tool then
  43. event:FireServer(tool)
  44. kg.E.Visible = false
  45. end
  46. end
  47. end
  48. end)
  49.  
  50. while wait(1) do
  51. local tool = search()
  52. if tool then
  53. kg.E.Visible = true
  54. else
  55. kg.E.Visible = false
  56. end
  57. end
  58.  
  59. --[[ ZOUK AG ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement