Run it
Copy the script and paste it into your executor.
local game = game
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local character = localPlayer.Character
local runService = game:GetService("RunService")
runService.RenderStepped:Connect(function()
character = localPlayer.Character
local target = nil
local distance = 100
local tool
for _,v in character:GetChildren() do
if v:FindFirstChild("Damage") then
tool = v
end
end
if tool then
for _,v in workspace:GetChildren() do
if v:FindFirstChild("Mob") and v:FindFirstChild("HumanoidRootPart") (v.HumanoidRootPart.CFrame.Position - character.HumanoidRootPart.CFrame.Position).Magnitude < distance
distance = (v.HumanoidRootPart.CFrame.Position - character.HumanoidRootPart.CFrame.Position).Magnitude
target = v
target
tool.Damage:(target)
)attacks any enemy nearby as long as you got a sword