--// Services local Players = game:GetService("Players") local StarterGui = game:GetService("StarterGui") local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") --// Cleanup previous GUI if PlayerGui:FindFirstChild("LuaLooperGUI") then PlayerGui.LuaLooperGUI:Destroy() end --// ScreenGui local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "LuaLooperGUI" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = PlayerGui --// Main Frame local Frame = Instance.new("Frame") Frame.Size = UDim2.new(0, 300, 0, 200) Frame.Position = UDim2.new(0.5, -150, 0.5, -100) Frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) Frame.Active = true Frame.Draggable = true Frame.Parent = ScreenGui --// TextBox local TextBox = Instance.new("TextBox") TextBox.Size = UDim2.new(1, -10, 0, 100) TextBox.Position = UDim2.new(0, 5, 0, 5) TextBox.PlaceholderText = "Enter Lua script here..." TextBox.Text = "" TextBox.MultiLine = true TextBox.TextWrapped = true TextBox.ClearTextOnFocus = false -- FIX: prevents clearing when clicked TextBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50) TextBox.TextColor3 = Color3.fromRGB(255,255,255) TextBox.Parent = Frame --// Toggle Button local ToggleButton = Instance.new("TextButton") ToggleButton.Size = UDim2.new(0.5, -7, 0, 40) ToggleButton.Position = UDim2.new(0, 5, 1, -45) ToggleButton.Text = "OFF" ToggleButton.BackgroundColor3 = Color3.fromRGB(120, 0, 0) ToggleButton.TextColor3 = Color3.fromRGB(255,255,255) ToggleButton.Parent = Frame --// Minimize Button local MinimizeButton = Instance.new("TextButton") MinimizeButton.Size = UDim2.new(0.5, -7, 0, 40) MinimizeButton.Position = UDim2.new(0.5, 2, 1, -45) MinimizeButton.Text = "-" MinimizeButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80) MinimizeButton.TextColor3 = Color3.fromRGB(255,255,255) MinimizeButton.Parent = Frame --// Minimized Button local MiniButton = Instance.new("TextButton") MiniButton.Size = UDim2.new(0, 100, 0, 40) MiniButton.Position = UDim2.new(0, 10, 0, 10) MiniButton.Text = "Open GUI" MiniButton.Visible = false MiniButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40) MiniButton.TextColor3 = Color3.fromRGB(255,255,255) MiniButton.Parent = ScreenGui --// Loop control local running = false local notified = false local cachedCode = "" -- FIX: store script once --// Toggle logic ToggleButton.MouseButton1Click:Connect(function() running = not running if running then ToggleButton.Text = "ON" ToggleButton.BackgroundColor3 = Color3.fromRGB(0, 120, 0) -- FIX: cache the textbox content once cachedCode = TextBox.Text if not notified then notified = true pcall(function() StarterGui:SetCore("SendNotification", { Title = "Lua Looper", Text = "Script loop started.", Duration = 3 }) end) end task.spawn(function() while running do if cachedCode and cachedCode ~= "" then local success, err = pcall(function() loadstring(cachedCode)() end) if not success then warn("Script Error:", err) end end task.wait(0.125) end end) else ToggleButton.Text = "OFF" ToggleButton.BackgroundColor3 = Color3.fromRGB(120, 0, 0) end end) --// Minimize logic MinimizeButton.MouseButton1Click:Connect(function() Frame.Visible = false MiniButton.Visible = true end) MiniButton.MouseButton1Click:Connect(function() Frame.Visible = true MiniButton.Visible = false end)