-- XErr AI Engine 1.7 Beta (Resilient) -- LocalScript -> StarterPlayerScripts local Players = game:GetService("Players") local HttpService = game:GetService("HttpService") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local PlayerGui = player:WaitForChild("PlayerGui") -- unique GUI name to avoid accidental deletion by other scripts local GUI_BASE_NAME = "XErr_AIE_1_7_Beta__" .. tostring(math.random(10000,99999)) -- track join times local joinTimes = {} Players.PlayerAdded:Connect(function(p) joinTimes[p.UserId] = os.time() end) for _,p in ipairs(Players:GetPlayers()) do if not joinTimes[p.UserId] then joinTimes[p.UserId] = os.time() end end -- helper: safe pcall wrapper local function safe(fn,...) local ok, res = pcall(fn, ...) if not ok then warn("[XErr] safe error:", res) end return ok, res end -- date formatting local function formatDate(unix) local t = os.date("!*t", unix or os.time()) return string.format("%04d-%02d-%02d %02d:%02d:%02d", t.year, t.month, t.day, t.hour, t.min, t.sec) end -- create GUI (returns gui) local function createGui() -- destroy existing with same base name (to rebuild cleanly) local existing = PlayerGui:FindFirstChild(GUI_BASE_NAME) if existing then safe(function() existing:Destroy() end) end local screenGui = Instance.new("ScreenGui") screenGui.Name = GUI_BASE_NAME screenGui.ResetOnSpawn = false screenGui.IgnoreGuiInset = false screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling screenGui.Parent = PlayerGui local frame = Instance.new("Frame", screenGui) frame.Name = "MainFrame" frame.Size = UDim2.new(0, 420, 0, 480) frame.Position = UDim2.new(0.03, 0, 0.08, 0) frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20) frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true local header = Instance.new("TextLabel", frame) header.Size = UDim2.new(1, 0, 0, 36) header.Position = UDim2.new(0,0,0,0) header.BackgroundColor3 = Color3.fromRGB(30,30,30) header.Text = "🤖 XErr AI Engine 1.7 Beta (Resilient)" header.Font = Enum.Font.GothamBold header.TextSize = 16 header.TextColor3 = Color3.fromRGB(255,255,255) header.Name = "Header" local search = Instance.new("TextBox", frame) search.Name = "SearchBox" search.Size = UDim2.new(0.96, 0, 0, 30) search.Position = UDim2.new(0.02, 0, 0.09, 0) search.PlaceholderText = "Search players..." search.ClearTextOnFocus = false search.Font = Enum.Font.Gotham search.TextSize = 14 local list = Instance.new("ScrollingFrame", frame) list.Name = "PlayerList" list.Size = UDim2.new(0.96, 0, 0.78, 0) list.Position = UDim2.new(0.02, 0, 0.16, 0) list.BackgroundTransparency = 1 list.ScrollBarThickness = 6 local layout = Instance.new("UIListLayout", list) layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Padding = UDim.new(0, 8) -- make player card (image on top, then name, age guess, join) local function makePlayerCard(p) local card = Instance.new("Frame") card.Size = UDim2.new(1, -10, 0, 210) card.BackgroundColor3 = Color3.fromRGB(28, 28, 28) card.BorderSizePixel = 0 card.Name = "Card_" .. tostring(p.UserId) local uiCorner = Instance.new("UICorner", card) uiCorner.CornerRadius = UDim.new(0, 8) local img = Instance.new("ImageLabel", card) img.Size = UDim2.new(0.6, 0, 0.5, 0) img.Position = UDim2.new(0.2, 0, 0.05, 0) img.BackgroundColor3 = Color3.fromRGB(18,18,18) img.BorderSizePixel = 0 img.Image = "rbxasset://textures/ui/GuiImagePlaceholder.png" img.Name = "AvatarImage" -- name label local nameLbl = Instance.new("TextLabel", card) nameLbl.Size = UDim2.new(1, -20, 0, 24) nameLbl.Position = UDim2.new(0, 10, 0.55, 0) nameLbl.BackgroundTransparency = 1 nameLbl.Text = p.Name nameLbl.Font = Enum.Font.GothamBold nameLbl.TextSize = 15 nameLbl.TextColor3 = Color3.new(1,1,1) nameLbl.TextXAlignment = Enum.TextXAlignment.Left nameLbl.Name = "NameLabel" -- age guess local ageLbl = Instance.new("TextLabel", card) ageLbl.Size = UDim2.new(1, -20, 0, 20) ageLbl.Position = UDim2.new(0, 10, 0.67, 0) ageLbl.BackgroundTransparency = 1 ageLbl.Text = "Fictional AI Age: " .. tostring(math.random(5,20)) ageLbl.Font = Enum.Font.Gotham ageLbl.TextSize = 13 ageLbl.TextColor3 = Color3.fromRGB(230,230,230) ageLbl.TextXAlignment = Enum.TextXAlignment.Left ageLbl.Name = "AgeLabel" -- joined server time local joinLbl = Instance.new("TextLabel", card) joinLbl.Size = UDim2.new(1, -20, 0, 20) joinLbl.Position = UDim2.new(0, 10, 0.78, 0) joinLbl.BackgroundTransparency = 1 local jt = joinTimes[p.UserId] or os.time() joinLbl.Text = "Joined Server: " .. formatDate(jt) joinLbl.Font = Enum.Font.Gotham joinLbl.TextSize = 13 joinLbl.TextColor3 = Color3.fromRGB(200,200,200) joinLbl.TextXAlignment = Enum.TextXAlignment.Left joinLbl.Name = "JoinLabel" -- buttons row (under everything) local btnFetch = Instance.new("TextButton", card) btnFetch.Size = UDim2.new(0.45, 0, 0, 28) btnFetch.Position = UDim2.new(0.05, 0, 0.89, 0) btnFetch.Text = "🔎 Fetch Profile" btnFetch.Font = Enum.Font.Gotham btnFetch.TextSize = 13 btnFetch.BackgroundColor3 = Color3.fromRGB(90, 90, 150) btnFetch.TextColor3 = Color3.fromRGB(1,1,1) btnFetch.Name = "FetchBtn" local btnAge = Instance.new("TextButton", card) btnAge.Size = UDim2.new(0.45, 0, 0, 28) btnAge.Position = UDim2.new(0.5, 0, 0.89, 0) btnAge.Text = "♻️ Refresh Age" btnAge.Font = Enum.Font.Gotham btnAge.TextSize = 13 btnAge.BackgroundColor3 = Color3.fromRGB(110, 80, 80) btnAge.TextColor3 = Color3.fromRGB(1,1,1) btnAge.Name = "AgeBtn" -- load thumbnail safely safe(function() local ok, thumb = pcall(function() return Players:GetUserThumbnailAsync(p.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150) end) if ok and thumb then img.Image = thumb end end) -- fetch profile creation date if HttpService allowed (safely) btnFetch.MouseButton1Click:Connect(function() local profileText = "Profile Created: unavailable" safe(function() if game:GetService("HttpService") then local ok2, res = pcall(function() local url = ("https://users.roblox.com/v1/users/%d"):format(p.UserId) return HttpService:GetAsync(url, true) end) if ok2 and res then local decoded = HttpService:JSONDecode(res) if decoded and decoded.created then profileText = "Profile Created: " .. tostring(decoded.created:gsub("T"," "):gsub("Z","")) end end end end) joinLbl.Text = joinLbl.Text .. " | " .. profileText end) -- refresh age (fictional) btnAge.MouseButton1Click:Connect(function() ageLbl.Text = "Fictional AI Age: " .. tostring(math.random(5,20)) end) return card end -- populate list function local function populate(filter) -- clear existing cards under the list but keep layout for _,c in ipairs(list:GetChildren()) do if c:IsA("Frame") then safe(function() c:Destroy() end) end end local players = Players:GetPlayers() table.sort(players, function(a,b) return a.Name:lower() < b.Name:lower() end) for _,p in ipairs(players) do local lname = p.Name:lower() if filter == "" or lname:find(filter,1,true) then local card = makePlayerCard(p) card.Parent = list end end -- adjust canvas size RunService.Heartbeat:Wait() local total = 0 for _,v in ipairs(list:GetChildren()) do if v:IsA("Frame") then total = total + v.Size.Y.Offset + layout.Padding.Offset end end list.CanvasSize = UDim2.new(0,0,0, math.max(1,total + 8)) end -- search handler search:GetPropertyChangedSignal("Text"):Connect(function() safe(function() populate((search.Text or ""):lower()) end) end) -- initial populate safe(function() populate("") end) -- update on players join/leave Players.PlayerAdded:Connect(function() safe(function() populate((search.Text or ""):lower()) end) end) Players.PlayerRemoving:Connect(function() safe(function() populate((search.Text or ""):lower()) end) end) -- attach some references for outside checks screenGui:SetAttribute("IsXErrAIE", true) screenGui:SetAttribute("CreatedTime", os.time()) return screenGui end -- ensure GUI exists and is healthy local function ensureGui() local g = PlayerGui:FindFirstChild(GUI_BASE_NAME) if g and g:GetAttribute("IsXErrAIE") then -- verify has content local mf = g:FindFirstChild("MainFrame") if not mf or #mf:GetChildren() < 3 then -- rebuild safe(function() createGui() end) end else safe(function() createGui() end) end end -- initial creation ensureGui() -- watch for accidental removals or clearing; if happens, recreate quickly PlayerGui.ChildRemoved:Connect(function(child) -- if someone removed our GUI, recreate if child and child.Name == GUI_BASE_NAME then task.delay(0.1, ensureGui) end end) -- also protect against internal clearing (cards removed) -- periodic check (lightweight) to ensure GUI didn't become empty local heartbeatCount = 0 RunService.Heartbeat:Connect(function(dt) heartbeatCount = heartbeatCount + 1 if heartbeatCount % 60 == 0 then -- about once per second (assuming 60fps) ensureGui() end end) -- reparent on respawn (in case PlayerGui was replaced) player.CharacterAdded:Connect(function() task.delay(1.5, ensureGui) end) -- error logging (silent) local LogService = game:GetService("LogService") LogService.MessageOut:Connect(function(message, messageType) if messageType == Enum.MessageType.MessageError then -- try to ensure GUI still there after errors task.delay(0.2, ensureGui) end end) -- done print("[XErr] Resilient GUI initialized:", GUI_BASE_NAME)