auto start waves for afk
Keyless

auto start waves for afk

🛠️Build and Kill VerityNovaromakessenseNovaromakessense 387 views 252 executesUpdated Oct 17, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•170 lines (4453 chars)
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local VirtualUser = game:GetService("VirtualUser")
local StarterGui = game:GetService("StarterGui")
local plr = Players.LocalPlayer
local Event = RS:WaitForChild("Events"):WaitForChild("DefenseStartWaves")

-- Anti AFK
plr.Idled:Connect(function()
	VirtualUser:CaptureController()
	VirtualUser:ClickButton2(Vector2.new())
end)

pcall(function()
	StarterGui:SetCore("SendNotification", {
		Title = "AntiAFK Berhasil!",
		Text = "Dibuat oleh Novarosenz",
		Button1 = "Ashiap",
		Duration = 5
	})
end)

-- UI Start Wave
local gui = Instance.new("ScreenGui", plr:WaitForChild("PlayerGui"))
gui.Name = "WaveStartUI"
gui.ResetOnSpawn = false

local frame = Instance.new("Frame", gui)
frame.Size = UDim2.fromOffset(180, 90)
frame.Position = UDim2.new(0.5, -90, 0.3, 0)
frame.BackgroundColor3 = Color3.fromRGB(30, 30, 35)
frame.Active = true
frame.Draggable = true
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 8)

local title = Instance.new("TextLabel", frame)
title.Size = UDim2.new(1, 0, 0, 22)
title.BackgroundTransparency = 1
title.Text = "Start Wave"
title.TextColor3 = Color3.new(1, 1, 1)
title.Font = Enum.Font.GothamBold
title.TextSize = 14

local box = Instance.new("TextBox", frame)
box.Size = UDim2.new(1, -16, 0, 28)
box.Position = UDim2.fromOffset(8, 28)
box.BackgroundColor3 = Color3.fromRGB(50, 50, 55)
box.Text = "1"
box.TextColor3 = Color3.new(1, 1, 1)
box.Font = Enum.Font.Gotham
box.TextSize = 16
box.ClearTextOnFocus = false
Instance.new("UICorner", box).CornerRadius = UDim.new(0, 6)

local btn = Instance.new("TextButton", frame)
btn.Size = UDim2.new(1, -16, 0, 26)
btn.Position = UDim2.fromOffset(8, 60)
btn.BackgroundColor3 = Color3.fromRGB(0, 140, 90)
btn.Text = "START"
btn.TextColor3 = Color3.new(1, 1, 1)
btn.Font = Enum.Font.GothamBold
btn.TextSize = 14
Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)

local function setBtn(text, color)
	btn.Text = text
	btn.BackgroundColor3 = color or Color3.fromRGB(0, 140, 90)
end

local function getWave()
	local n = tonumber(box.Text)
	return n and math.max(1, math.floor(n)) or 1
end

local function fireWave()
	local wave = getWave()
	pcall(function()
		Event:FireServer({
			Mode = "Normal",
			StartWave = wave
		})
	end)
	print("Start wave:", wave)
end

local function getClaim()
	local main = plr.PlayerGui:FindFirstChild("Main")
	local endResult = main and main:FindFirstChild("EndResult")
	local action = endResult and endResult:FindFirstChild("Action")
	return action and action:FindFirstChild("Claim")
end

local function clickClaim()
	local claim = getClaim()
	if not claim then return false end
	pcall(function()
		claim:Activate()
	end)
	pcall(function()
		if firesignal then
			firesignal(claim.MouseButton1Click)
			firesignal(claim.Activated)
		end
	end)
	print("Claim ditekan")
	return true
end

local busy = false
local cancel = false
local lastId = tonumber(plr:GetAttribute("DefenseResultId")) or 0

local function onResultIdUp()
	if busy then return end
	busy = true
	cancel = false
	task.spawn(function()
		setBtn("WAITING...", Color3.fromRGB(120, 120, 60))
		task.wait(2)
		if cancel then setBtn("CANCELED", Color3.fromRGB(160, 50, 50)) busy = false return end

		setBtn("CLAIMING...", Color3.fromRGB(180, 120, 40))
		clickClaim()
		task.wait(2)
		if cancel then setBtn("CANCELED", Color3.fromRGB(160, 50, 50)) busy = false return end

		setBtn("STARTING...", Color3.fromRGB(40, 120, 180))
		fireWave()
		task.wait(0.8)
		if cancel then setBtn("CANCELED", Color3.fromRGB(160, 50, 50)) busy = false return end

		setBtn("START", Color3.fromRGB(0, 140, 90))
		busy = false
	end)
end

btn.MouseButton1Click:Connect(function()
	if busy then
		-- cancel proses yang sedang jalan
		cancel = true
		setBtn("CANCELED", Color3.fromRGB(160, 50, 50))
		task.delay(1, function()
			if not busy then
				setBtn("START", Color3.fromRGB(0, 140, 90))
			end
		end)
		return
	end

	-- start manual
	busy = true
	cancel = false
	setBtn("STARTING...", Color3.fromRGB(40, 120, 180))
	fireWave()
	task.wait(0.8)
	if not cancel then
		setBtn("START", Color3.fromRGB(0, 140, 90))
	else
		setBtn("CANCELED", Color3.fromRGB(160, 50, 50))
	end
	busy = false
end)

plr:GetAttributeChangedSignal("DefenseResultId"):Connect(function()
	local now = tonumber(plr:GetAttribute("DefenseResultId")) or 0
	if now == lastId + 1 and not cancel then
		onResultIdUp()
	end
	lastId = now
end)

Features & Information

auto start waves in build and kill verity for long afk runs
#build and kill verity#UPDBuild and Kill Verity#build and kill

Community Comments (0)

No comments yet for this script.