-- EggAutoHatchGUI.lua local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -------------------------------------------------- -- REMOTES -------------------------------------------------- local hatchRemote = ReplicatedStorage:WaitForChild("EggHatchingRemote",10) local hatchServer = hatchRemote:WaitForChild("HatchServer",10) -------------------------------------------------- -- EGGS -------------------------------------------------- local eggsFolder = workspace:WaitForChild("Eggs",10) local megaEgg = eggsFolder:WaitForChild("Mega Egg",10) local lucidEgg = eggsFolder:WaitForChild("Lucid Egg",10) if not (hatchServer and megaEgg and lucidEgg) then warn("Missing eggs or remote") return end -------------------------------------------------- -- GUI -------------------------------------------------- local gui = Instance.new("ScreenGui") gui.Name = "EggAutoHatchGUI" gui.ResetOnSpawn = false gui.Parent = playerGui local frame = Instance.new("Frame") frame.Size = UDim2.new(0,220,0,140) frame.Position = UDim2.new(0.5,-110,0.5,-70) frame.BackgroundColor3 = Color3.fromRGB(35,35,40) frame.BorderSizePixel = 0 frame.Parent = gui Instance.new("UICorner",frame).CornerRadius = UDim.new(0,10) -------------------------------------------------- -- TITLE -------------------------------------------------- local title = Instance.new("TextLabel") title.Size = UDim2.new(1,0,0,30) title.BackgroundTransparency = 1 title.Text = "Auto Hatch" title.Font = Enum.Font.GothamBold title.TextSize = 16 title.TextColor3 = Color3.new(1,1,1) title.Parent = frame -------------------------------------------------- -- CLOSE BUTTON -------------------------------------------------- local close = Instance.new("TextButton") close.Size = UDim2.new(0,22,0,22) close.Position = UDim2.new(1,-26,0,4) close.Text = "X" close.Font = Enum.Font.GothamBold close.TextSize = 14 close.TextColor3 = Color3.new(1,1,1) close.BackgroundColor3 = Color3.fromRGB(200,60,60) close.Parent = frame Instance.new("UICorner",close).CornerRadius = UDim.new(0,6) -------------------------------------------------- -- TOGGLE CREATOR -------------------------------------------------- local function createToggle(text,y,color) local btn = Instance.new("TextButton") btn.Size = UDim2.new(0,170,0,35) btn.Position = UDim2.new(0.5,-85,0,y) btn.Text = text.." OFF" btn.Font = Enum.Font.GothamSemibold btn.TextSize = 14 btn.TextColor3 = Color3.new(1,1,1) btn.BackgroundColor3 = color btn.Parent = frame Instance.new("UICorner",btn).CornerRadius = UDim.new(0,6) return btn end local megaToggle = createToggle("Mega Egg",45,Color3.fromRGB(255,170,70)) local lucidToggle = createToggle("Lucid Egg",85,Color3.fromRGB(70,170,255)) -------------------------------------------------- -- STATE -------------------------------------------------- local megaOn = false local lucidOn = false -------------------------------------------------- -- HATCH FUNCTION -------------------------------------------------- local function hatchEgg(egg) pcall(function() if hatchServer:IsA("RemoteFunction") then hatchServer:InvokeServer(egg) else hatchServer:FireServer(egg) end end) end -------------------------------------------------- -- LOOPS -------------------------------------------------- local function startMega() task.spawn(function() while megaOn do hatchEgg(megaEgg) task.wait(0.001) end end) end local function startLucid() task.spawn(function() while lucidOn do hatchEgg(lucidEgg) task.wait(0.001) end end) end -------------------------------------------------- -- TOGGLES -------------------------------------------------- megaToggle.MouseButton1Click:Connect(function() megaOn = not megaOn if megaOn then megaToggle.Text = "Mega Egg ON" megaToggle.BackgroundColor3 = Color3.fromRGB(60,200,60) startMega() else megaToggle.Text = "Mega Egg OFF" megaToggle.BackgroundColor3 = Color3.fromRGB(255,170,70) end end) lucidToggle.MouseButton1Click:Connect(function() lucidOn = not lucidOn if lucidOn then lucidToggle.Text = "Lucid Egg ON" lucidToggle.BackgroundColor3 = Color3.fromRGB(60,200,60) startLucid() else lucidToggle.Text = "Lucid Egg OFF" lucidToggle.BackgroundColor3 = Color3.fromRGB(70,170,255) end end) -------------------------------------------------- -- CLOSE -------------------------------------------------- close.MouseButton1Click:Connect(function() megaOn = false lucidOn = false gui:Destroy() end) -------------------------------------------------- -- DRAGGING -------------------------------------------------- local dragging = false local dragInput local dragStart local startPos title.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) title.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then local delta = input.Position - dragStart frame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) print("Auto Hatch GUI loaded successfully")