CaliberMag

Untitled

Feb 16th, 2021 (edited)
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local UIS = game:GetService("UserInputService")
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local RunService = game:GetService("RunService")
  5.  
  6. local function GetEvent(Weapon)
  7. if Players.LocalPlayer.Character[Weapon.Name] then
  8. local Event = Weapon:FindFirstChild("Detection").Event
  9. return Event
  10. end
  11. end
  12.  
  13. local Enabled = false
  14. UIS.InputBegan:Connect(function(Input)
  15. if Input.KeyCode == Enum.KeyCode[_G.Keybind] then
  16. if Enabled == false then
  17. Enabled = true
  18. Aura()
  19.  
  20. warn("Active.")
  21. else
  22. Enabled = false
  23. end
  24. end
  25. end)
  26.  
  27. function Aura()
  28. local LastTime = 0
  29.  
  30. if Enabled then
  31. PlayerDetection = RunService.Heartbeat:Connect(function()
  32. if tick() - LastTime >= _G.Step then
  33. LastTime = tick()
  34. if Players.LocalPlayer.Character ~= nil then
  35. for _, ClosestPlayer in pairs(Players:GetChildren()) do
  36. if ClosestPlayer.Character:FindFirstChild("Head") and ClosestPlayer.Character.Head:FindFirstChild("TeamGui") then
  37. if ClosestPlayer.Character.Head.TeamGui.Enabled ~= true then
  38. local HumanoidRootPart = ClosestPlayer.Character:FindFirstChild("HumanoidRootPart")
  39. if HumanoidRootPart and HumanoidRootPart ~= Players.LocalPlayer.Character.HumanoidRootPart and (HumanoidRootPart.Position - Players.LocalPlayer.Character.HumanoidRootPart.Position).Magnitude <= _G.DistanceCheck then
  40. local Gear = Players.LocalPlayer.Character:FindFirstChild("Gear")
  41. if Gear then
  42. local DetectionEvent = GetEvent(Gear)
  43. if DetectionEvent then
  44. ReplicatedStorage.Resources.Data.Events.Traffic.Gear:InvokeServer("Action", HumanoidRootPart.Position)
  45. DetectionEvent:FireServer("HumanoidRootPart")
  46.  
  47. local Camera = workspace.CurrentCamera
  48. --Workspace.CurrentCamera.CFrame = CFrame.new(Camera.CFrame.Position, HumanoidRootPart.CFrame.Position)
  49. --break
  50. else
  51. --warn("Detection event not found.")
  52. end
  53. else
  54. --warn("Weapon not equipped.")
  55. end
  56. end
  57. end
  58. end
  59. end
  60. end
  61. end
  62. if Enabled ~= true then
  63. PlayerDetection:Disconnect()
  64. warn("Disconnected.")
  65. end
  66. end)
  67. end
  68. end
Add Comment
Please, Sign In to add comment