1 | |
2 | |
3 | local Players = game:GetService("Players") |
4 | local RunService = game:GetService("RunService") |
5 | local UserInputService = game:GetService("UserInputService") |
6 | local LocalPlayer = Players.LocalPlayer |
7 | |
8 | local KillauraEnabled = false |
9 | local VisualizerEnabled = false |
10 | local KillauraRange = 15 |
11 | local KillauraAngle = 360 |
12 | local KillauraSwingTick = 0 |
13 | local KillauraCPS = {Min = 8, Max = 12} |
14 | local KillauraRangeCirclePart |
15 | |
16 | |
17 | local function ToggleVisualizer(enable) |
18 | if enable then |
19 | KillauraRangeCirclePart = Instance.new("MeshPart") |
20 | KillauraRangeCirclePart.MeshId = "rbxassetid://3726303797" |
21 | KillauraRangeCirclePart.Color = Color3.new(1, 0, 0) |
22 | KillauraRangeCirclePart.CanCollide = false |
23 | KillauraRangeCirclePart.Anchored = true |
24 | KillauraRangeCirclePart.Material = Enum.Material.Neon |
25 | KillauraRangeCirclePart.Size = Vector3.new(KillauraRange * 0.7, 0.01, KillauraRange * 0.7) |
26 | KillauraRangeCirclePart.Parent = workspace.CurrentCamera |
27 | else |
28 | if KillauraRangeCirclePart then |
29 | KillauraRangeCirclePart:Destroy() |
30 | KillauraRangeCirclePart = nil |
31 | end |
32 | end |
33 | end |
34 | |
35 | |
36 | local function AllNearPosition(range, maxCount) |
37 | local nearbyPlayers = {} |
38 | for _, player in ipairs(Players:GetPlayers()) do |
39 | if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then |
40 | local distance = (LocalPlayer.Character.HumanoidRootPart.Position - player.Character.HumanoidRootPart.Position).Magnitude |
41 | if distance <= range then |
42 | table.insert(nearbyPlayers, player) |
43 | if #nearbyPlayers >= maxCount then |
44 | break |
45 | end |
46 | end |
47 | end |
48 | end |
49 | return nearbyPlayers |
50 | end |
51 | |
52 | |
53 | local function AttackPlayer(player) |
54 | local tool = LocalPlayer.Character:FindFirstChildWhichIsA("Tool") |
55 | if tool and tool:FindFirstChildOfClass("TouchTransmitter") then |
56 | local touch = tool:FindFirstChildOfClass("TouchTransmitter") |
57 | if KillauraSwingTick <= tick() then |
58 | tool:Activate() |
59 | KillauraSwingTick = tick() + (1 / math.random(KillauraCPS.Min, KillauraCPS.Max)) |
60 | end |
61 | for _, part in ipairs(player.Character:GetChildren()) do |
62 | if part:IsA("BasePart") then |
63 | firetouchinterest(touch.Parent, part, 1) |
64 | firetouchinterest(touch.Parent, part, 0) |
65 | end |
66 | end |
67 | end |
68 | end |
69 | |
70 | |
71 | local function KillauraLogic() |
72 | if KillauraEnabled then |
73 | local nearbyPlayers = AllNearPosition(KillauraRange, 100) |
74 | for _, player in ipairs(nearbyPlayers) do |
75 | local angle = math.acos(LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector:Dot((player.Character.HumanoidRootPart.Position - LocalPlayer.Character.HumanoidRootPart.Position).Unit)) |
76 | if angle <= math.rad(KillauraAngle) / 2 then |
77 | AttackPlayer(player) |
78 | end |
79 | end |
80 | end |
81 | end |
82 | |
83 | |
84 | local function EnsureCharacter() |
85 | if not LocalPlayer.Character or not LocalPlayer.Character:FindFirstChild("Humanoid") then |
86 | LocalPlayer.CharacterAdded:Wait() |
87 | LocalPlayer.Character:WaitForChild("Humanoid") |
88 | end |
89 | return LocalPlayer.Character |
90 | end |
91 | |
92 | |
93 | UserInputService.InputBegan:Connect(function(input, gameProcessed) |
94 | if gameProcessed then return end |
95 | if input.KeyCode == Enum.KeyCode.J then |
96 | KillauraEnabled = not KillauraEnabled |
97 | elseif input.KeyCode == Enum.KeyCode.K then |
98 | VisualizerEnabled = not VisualizerEnabled |
99 | ToggleVisualizer(VisualizerEnabled) |
100 | end |
101 | end) |
102 | |
103 | |
104 | RunService.Heartbeat:Connect(function() |
105 | local character = EnsureCharacter() |
106 | if VisualizerEnabled and KillauraRangeCirclePart then |
107 | KillauraRangeCirclePart.CFrame = character.HumanoidRootPart.CFrame - Vector3.new(0, character.Humanoid.HipHeight + (character.HumanoidRootPart.Size.Y / 2) - 0.3, 0) |
108 | end |
109 | KillauraLogic() |
110 | end) |