-- kill npc gui local screenGui = Instance.new("ScreenGui") screenGui.Name = "KillAllNPCs" screenGui.ResetOnSpawn = false local button = Instance.new("TextButton") button.Size = UDim2.new(0, 200, 0, 50) button.Position = UDim2.new(0.5, -100, 0.5, -25) button.Text = "Start kill" button.Font = Enum.Font.SourceSansBold button.TextSize = 20 button.BackgroundColor3 = Color3.new(0.3, 0.7, 0.3) button.BorderSizePixel = 0 button.Parent = screenGui screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui") local dragging = false local dragInput, mousePos, framePos local function update(input) local delta = input.Position - mousePos button.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y) end button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true mousePos = input.Position framePos = button.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) button.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then dragInput = input end end) game:GetService("UserInputService").InputChanged:Connect(function(input) if dragging and input == dragInput then update(input) end end) local function killAllNPCs() while wait(0.01) do for _, d in ipairs(game.Workspace:GetDescendants()) do if d:IsA("Humanoid") then local isPlayer = false for _, player in ipairs(game.Players:GetPlayers()) do if d.Parent == player.Character then isPlayer = true break end end if not isPlayer then d.Health = -1 d:ChangeState(Enum.HumanoidStateType.Dead) d:TakeDamage(9999999999) end end end end end local isKilling = false button.MouseButton1Click:Connect(function() if not dragging then if isKilling then isKilling = false button.Text = "Start kill" button.BackgroundColor3 = Color3.new(0.3, 0.7, 0.3) else isKilling = true button.Text = "Stop kill" button.BackgroundColor3 = Color3.new(1, 0, 0) coroutine.resume(coroutine.create(killAllNPCs)) end end end)