--// This doesn't target NPCs, but why would you want to target NPCs?
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local plr = Players.LocalPlayer
local range = 15
local interval = 0.05
local gui = Instance.new("ScreenGui")
gui.Name = "HitButtonGui"
gui.ResetOnSpawn = false
gui.Parent = plr:WaitForChild("PlayerGui")
local button = Instance.new("TextButton")
button.Name = "HitButton"
button.Size = UDim2.new(0, 200, 0, 50)
button.Position = UDim2.new(0.5, -100, 0.8, 0)
button.Text = "Toggle KillAura"
button.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.Font = Enum.Font.GothamBold
button.TextSize = 20
button.Parent = gui
local warninglabel = Instance.new("TextLabel")
warninglabel.Size = UDim2.new(0, 200, 0, 20)
warninglabel.Position = UDim2.new(0.5, -400, 0.85, -44)
warninglabel.Text = "! Warning: Values above 15 could get you kicked !"
warninglabel.BackgroundTransparency = 1
warninglabel.TextColor3 = Color3.fromRGB(255, 70, 70)
warninglabel.Font = Enum.Font.GothamBold
warninglabel.TextSize = 16
warninglabel.TextXAlignment = Enum.TextXAlignment.Center
warninglabel.Visible = false
warninglabel.Parent = gui
local rangebox = Instance.new("TextBox")
rangebox.Name = "RangeBox"
rangebox.Size = UDim2.new(0, 100, 0, 30)
rangebox.Position = UDim2.new(0.5, -350, 0.85, 0)
rangebox.Text = tostring(range)
rangebox.TextXAlignment = Enum.TextXAlignment.Center
rangebox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
rangebox.TextColor3 = Color3.fromRGB(255, 255, 255)
rangebox.Font = Enum.Font.Gotham
rangebox.TextSize = 16
rangebox.Parent = gui
rangebox.Changed:Connect(function()
local newRange = tonumber(rangebox.Text)
if newRange then
range = newRange
warninglabel.Visible = range >= 16
end
end)
local intervalbox = Instance.new("TextBox")
intervalbox.Name = "IntervalBox"
intervalbox.Size = UDim2.new(0, 100, 0, 30)
intervalbox.Position = UDim2.new(0.5, 250, 0.85, 0)
intervalbox.Text = tostring(interval)
intervalbox.TextXAlignment = Enum.TextXAlignment.Center
intervalbox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
intervalbox.TextColor3 = Color3.fromRGB(255, 255, 255)
intervalbox.Font = Enum.Font.Gotham
intervalbox.TextSize = 16
intervalbox.Parent = gui
intervalbox.Changed:Connect(function()
interval = tonumber(intervalbox.Text) or interval
end)
local rangelabel = Instance.new("TextLabel")
rangelabel.Size = UDim2.new(0, 100, 0, 20)
rangelabel.Position = UDim2.new(0.5, -350, 0.85, -22)
rangelabel.Text = "Range"
rangelabel.BackgroundTransparency = 1
rangelabel.TextColor3 = Color3.fromRGB(200, 200, 200)
rangelabel.Font = Enum.Font.GothamBold
rangelabel.TextSize = 16
rangelabel.TextXAlignment = Enum.TextXAlignment.Center
rangelabel.Parent = gui
local intervallabel = Instance.new("TextLabel")
intervallabel.Size = UDim2.new(0, 100, 0, 20)
intervallabel.Position = UDim2.new(0.5, 250, 0.85, -22)
intervallabel.Text = "Interval"
intervallabel.BackgroundTransparency = 1
intervallabel.TextColor3 = Color3.fromRGB(200, 200, 200)
intervallabel.Font = Enum.Font.GothamBold
intervallabel.TextSize = 16
intervallabel.TextXAlignment = Enum.TextXAlignment.Center
intervallabel.Parent = gui
local running = false
button.MouseButton1Click:Connect(function()
running = not running
while running do
local character = plr.Character
local hrp = character and character:FindFirstChild("HumanoidRootPart")
if hrp then
for _, v in ipairs(Players:GetPlayers()) do
if v ~= plr and v.Character and v.Character:FindFirstChild("HumanoidRootPart") then
local dist = (v.Character.HumanoidRootPart.Position - hrp.Position).Magnitude
if dist < range then
ReplicatedStorage:WaitForChild("Events"):WaitForChild("HitCharacter"):FireServer(v.Character)
end
end
end
end
task.wait(interval)
end
end)
Comments
No comments yet
Be the first to share your thoughts!