local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local attacking = false
local selectedTarget = nil
-- Achievement GUI
local gui = Instance.new("ScreenGui", game.CoreGui)
gui.Name = "DGHEditzAttackGUI"
local achievementFrame = Instance.new("Frame")
achievementFrame.Size = UDim2.new(0, 250, 0, 60)
achievementFrame.Position = UDim2.new(0.5, -125, 0.05, -60)
achievementFrame.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
achievementFrame.BorderSizePixel = 0
achievementFrame.Visible = false
achievementFrame.AnchorPoint = Vector2.new(0.5, 0)
achievementFrame.Parent = gui
achievementFrame.BackgroundTransparency = 0.1
achievementFrame.ClipsDescendants = true
local achText = Instance.new("TextLabel", achievementFrame)
achText.Size = UDim2.new(1, 0, 1, 0)
achText.BackgroundTransparency = 1
achText.TextColor3 = Color3.new(1, 1, 1)
achText.Font = Enum.Font.GothamBold
achText.TextSize = 16
achText.Text = "Created by: DGHEditz"
local function showAchievement(text)
achText.Text = text or "Created by: DGHEditz"
achievementFrame.Visible = true
achievementFrame.Position = UDim2.new(0.5, -125, 0.05, -60)
local tweenIn = TweenService:Create(achievementFrame, TweenInfo.new(0.4), {
Position = UDim2.new(0.5, -125, 0.05, 0)
})
tweenIn:Play()
task.delay(3, function()
local tweenOut = TweenService:Create(achievementFrame, TweenInfo.new(0.4), {
Position = UDim2.new(0.5, -125, 0.05, -60)
})
tweenOut:Play()
end)
end
local function isFriend(player)
local success, result = pcall(function()
return LocalPlayer:IsFriendsWith(player.UserId)
end)
return success and result
end
local function findNearestPlayer(ignoreFriends)
local closest = nil
local shortestDist = math.huge
for _, player in ipairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
if ignoreFriends and isFriend(player) then
continue
end
local dist = (player.Character.HumanoidRootPart.Position - LocalPlayer.Character.HumanoidRootPart.Position).Magnitude
if dist < shortestDist then
shortestDist = dist
closest = player
end
end
end
return closest
end
local function attackLoop()
while attacking and selectedTarget and selectedTarget.Character and selectedTarget.Character:FindFirstChild("HumanoidRootPart") do
local hrp = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
local targetHRP = selectedTarget.Character.HumanoidRootPart
if hrp and targetHRP then
local velocity = targetHRP.AssemblyLinearVelocity
local offset = Vector3.new()
if velocity.Magnitude > 0.1 then
local forward = targetHRP.CFrame.LookVector
local dot = forward:Dot(velocity.Unit)
if dot > 0.2 then
offset = forward * 1.5
elseif dot < -0.2 then
offset = -forward * 1.5
else
local right = targetHRP.CFrame.RightVector
local sideDot = right:Dot(velocity.Unit)
offset = sideDot > 0 and right * 1.5 or -right * 1.5
end
else
offset = (targetHRP.Position - hrp.Position).Unit * 1.5
end
local targetPos = targetHRP.Position - offset
hrp.CFrame = CFrame.new(targetPos, targetHRP.Position)
end
task.wait(0.001)
end
end
local function startAttack(ignoreFriends)
if attacking then return end
selectedTarget = findNearestPlayer(ignoreFriends)
if selectedTarget then
attacking = true
showAchievement("Attacking: " .. selectedTarget.Name)
task.spawn(attackLoop)
end
end
local function stopAttack()
attacking = false
selectedTarget = nil
showAchievement("Attack stopped")
end
-- GUI Panel
local frame = Instance.new("Frame", gui)
frame.Size = UDim2.new(0, 200, 0, 160)
frame.Position = UDim2.new(0.1, 0, 0.3, 0)
frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
frame.Active = true
frame.Draggable = true
frame.BorderSizePixel = 0
-- Scrollable container (for more buttons if needed)
local scroll = Instance.new("ScrollingFrame", frame)
scroll.Size = UDim2.new(1, 0, 1, 0)
scroll.CanvasSize = UDim2.new(0, 0, 0, 160)
scroll.ScrollBarThickness = 4
scroll.BackgroundTransparency = 1
local UIListLayout = Instance.new("UIListLayout", scroll)
UIListLayout.Padding = UDim.new(0, 5)
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
local function makeButton(text, callback)
local btn = Instance.new("TextButton", scroll)
btn.Size = UDim2.new(1, -20, 0, 40)
btn.Position = UDim2.new(0, 10, 0, 0)
btn.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
btn.TextColor3 = Color3.new(1, 1, 1)
btn.Font = Enum.Font.GothamBold
btn.TextSize = 14
btn.Text = text
btn.AutoButtonColor = true
btn.MouseButton1Click:Connect(callback)
end
makeButton("Start Attack", function()
startAttack(false)
end)
makeButton("Start Attack (Ignore Friends)", function()
startAttack(true)
end)
makeButton("Stop Attack", function()
stopAttack()
end)
-- Pokazanie info startowego
showAchievement("Created by: DGHEditz")
Comments
No comments yet
Be the first to share your thoughts!