Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UIS = game:GetService("UserInputService")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local RunService = game:GetService("RunService")
- local function GetEvent(Weapon)
- if Players.LocalPlayer.Character[Weapon.Name] then
- local Event = Weapon:FindFirstChild("Detection").Event
- return Event
- end
- end
- local Enabled = false
- UIS.InputBegan:Connect(function(Input)
- if Input.KeyCode == Enum.KeyCode[_G.Keybind] then
- if Enabled == false then
- Enabled = true
- Aura()
- warn("Active.")
- else
- Enabled = false
- end
- end
- end)
- function Aura()
- local LastTime = 0
- if Enabled then
- PlayerDetection = RunService.Heartbeat:Connect(function()
- if tick() - LastTime >= _G.Step then
- LastTime = tick()
- if Players.LocalPlayer.Character ~= nil then
- for _, ClosestPlayer in pairs(Players:GetChildren()) do
- if ClosestPlayer.Character:FindFirstChild("Head") and ClosestPlayer.Character.Head:FindFirstChild("TeamGui") then
- if ClosestPlayer.Character.Head.TeamGui.Enabled ~= true then
- local HumanoidRootPart = ClosestPlayer.Character:FindFirstChild("HumanoidRootPart")
- if HumanoidRootPart and HumanoidRootPart ~= Players.LocalPlayer.Character.HumanoidRootPart and (HumanoidRootPart.Position - Players.LocalPlayer.Character.HumanoidRootPart.Position).Magnitude <= _G.DistanceCheck then
- local Gear = Players.LocalPlayer.Character:FindFirstChild("Gear")
- if Gear then
- local DetectionEvent = GetEvent(Gear)
- if DetectionEvent then
- ReplicatedStorage.Resources.Data.Events.Traffic.Gear:InvokeServer("Action", HumanoidRootPart.Position)
- DetectionEvent:FireServer("HumanoidRootPart")
- local Camera = workspace.CurrentCamera
- --Workspace.CurrentCamera.CFrame = CFrame.new(Camera.CFrame.Position, HumanoidRootPart.CFrame.Position)
- --break
- else
- --warn("Detection event not found.")
- end
- else
- --warn("Weapon not equipped.")
- end
- end
- end
- end
- end
- end
- end
- if Enabled ~= true then
- PlayerDetection:Disconnect()
- warn("Disconnected.")
- end
- end)
- end
- end
Add Comment
Please, Sign In to add comment