local Players = game:GetService("Players") local TeleportService = game:GetService("TeleportService") local UserInputService = game:GetService("UserInputService") local CoreGui = game:GetService("CoreGui") local player = Players.LocalPlayer local camera = workspace.CurrentCamera local function getScreenSize() if camera and camera.ViewportSize then return camera.ViewportSize end return Vector2.new(1280, 720) end local function roundify(obj, radius) local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, radius) corner.Parent = obj end local function setLabelText(label, text, color) label.Text = text label.TextColor3 = color or Color3.fromRGB(255, 255, 255) end local function parsePrivateServerCode(raw) local text = tostring(raw or ""):gsub("^%s+", ""):gsub("%s+$", "") if text == "" then return nil end local linkCode = text:match("privateServerLinkCode=([^&]+)") if linkCode then return linkCode end return text end local screen = getScreenSize() local width = math.clamp(screen.X * 0.9, 300, 440) local height = math.clamp(screen.Y * 0.72, 320, 520) local gui = Instance.new("ScreenGui") gui.Name = "DeltaPrivateServerUI" gui.ResetOnSpawn = false gui.Parent = CoreGui local frame = Instance.new("Frame") frame.Size = UDim2.fromOffset(width, height) frame.Position = UDim2.fromOffset((screen.X - width) / 2, math.max(24, screen.Y * 0.08)) frame.BackgroundColor3 = Color3.fromRGB(15, 15, 20) frame.BorderSizePixel = 0 frame.Parent = gui roundify(frame, 16) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -24, 0, 42) title.Position = UDim2.new(0, 12, 0, 12) title.BackgroundTransparency = 1 title.Text = "Private Server Joiner" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.GothamBold title.TextSize = 22 title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = frame local subtitle = Instance.new("TextLabel") subtitle.Size = UDim2.new(1, -24, 0, 24) subtitle.Position = UDim2.new(0, 12, 0, 50) subtitle.BackgroundTransparency = 1 subtitle.Text = "Mobile + PC friendly UI" subtitle.TextColor3 = Color3.fromRGB(160, 160, 180) subtitle.Font = Enum.Font.Gotham subtitle.TextSize = 13 subtitle.TextXAlignment = Enum.TextXAlignment.Left subtitle.Parent = frame local function createInput(labelText, y, default) local label = Instance.new("TextLabel") label.Size = UDim2.new(1, -24, 0, 18) label.Position = UDim2.new(0, 12, 0, y) label.BackgroundTransparency = 1 label.Text = labelText label.TextColor3 = Color3.fromRGB(220, 220, 230) label.Font = Enum.Font.GothamSemibold label.TextSize = 13 label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = frame local box = Instance.new("TextBox") box.Size = UDim2.new(1, -24, 0, 38) box.Position = UDim2.new(0, 12, 0, y + 20) box.BackgroundColor3 = Color3.fromRGB(25, 26, 34) box.TextColor3 = Color3.fromRGB(255, 255, 255) box.PlaceholderText = default box.Text = default box.Font = Enum.Font.Gotham box.TextSize = 15 box.ClearTextOnFocus = false box.Parent = frame roundify(box, 10) local stroke = Instance.new("UIStroke") stroke.Color = Color3.fromRGB(60, 60, 75) stroke.Thickness = 1 stroke.Parent = box return box end local placeBox = createInput("Target Place ID", 88, tostring(game.PlaceId)) local codeBox = createInput("Private Server Link or Code", 154, "") local status = Instance.new("TextLabel") status.Size = UDim2.new(1, -24, 0, 48) status.Position = UDim2.new(0, 12, 0, height - 110) status.BackgroundTransparency = 1 status.Text = "Enter the place ID and private server code/link" status.TextColor3 = Color3.fromRGB(180, 200, 255) status.Font = Enum.Font.Gotham status.TextSize = 14 status.TextWrapped = true status.Parent = frame local joinButton = Instance.new("TextButton") joinButton.Size = UDim2.new(1, -24, 0, 50) joinButton.Position = UDim2.new(0, 12, 0, height - 56) joinButton.BackgroundColor3 = Color3.fromRGB(76, 166, 255) joinButton.TextColor3 = Color3.fromRGB(255, 255, 255) joinButton.Text = "Join Private Server" joinButton.Font = Enum.Font.GothamBold joinButton.TextSize = 16 joinButton.Parent = frame roundify(joinButton, 12) local buttonStroke = Instance.new("UIStroke") buttonStroke.Color = Color3.fromRGB(90, 190, 255) buttonStroke.Thickness = 1 buttonStroke.Parent = joinButton -- Draggable window for easier use on mobile/PC local dragging = false local dragStart local startPos frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = frame.Position end end) frame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) frame.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart frame.Position = UDim2.new(0, startPos.X.Offset + delta.X, 0, startPos.Y.Offset + delta.Y) end end) joinButton.MouseButton1Click:Connect(function() local placeId = tonumber(placeBox.Text) local serverCode = parsePrivateServerCode(codeBox.Text) if not placeId or not serverCode then setLabelText(status, "Please enter a valid Place ID and private server code/link.", Color3.fromRGB(255, 120, 120)) return end if game.PlaceId ~= placeId then setLabelText(status, "This server is not the target place. Open the target place first.", Color3.fromRGB(255, 200, 100)) return end local teleportData = TeleportService:GetTeleportData() if teleportData and teleportData.__fromPrivateServerUI then setLabelText(status, "Already joined from this UI.", Color3.fromRGB(120, 255, 120)) return end setLabelText(status, "Trying to join private server...", Color3.fromRGB(150, 220, 255)) local ok, err = pcall(function() TeleportService:TeleportToPrivateServer( placeId, serverCode, {player}, { __fromPrivateServerUI = true } ) end) if ok then setLabelText(status, "Teleport request sent. If nothing happens, the game may block this from client-side execution.", Color3.fromRGB(120, 255, 120)) else setLabelText(status, "Teleport failed: " .. tostring(err), Color3.fromRGB(255, 120, 120)) end end)local Players = game:GetService("Players") local TeleportService = game:GetService("TeleportService") local UserInputService = game:GetService("UserInputService") local CoreGui = game:GetService("CoreGui") local player = Players.LocalPlayer local camera = workspace.CurrentCamera local function getScreenSize() if camera and camera.ViewportSize then return camera.ViewportSize end return Vector2.new(1280, 720) end local function roundify(obj, radius) local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, radius) corner.Parent = obj end local function setLabelText(label, text, color) label.Text = text label.TextColor3 = color or Color3.fromRGB(255, 255, 255) end local function parsePrivateServerCode(raw) local text = tostring(raw or ""):gsub("^%s+", ""):gsub("%s+$", "") if text == "" then return nil end local linkCode = text:match("privateServerLinkCode=([^&]+)") if linkCode then return linkCode end return text end local screen = getScreenSize() local width = math.clamp(screen.X * 0.9, 300, 440) local height = math.clamp(screen.Y * 0.72, 320, 520) local gui = Instance.new("ScreenGui") gui.Name = "DeltaPrivateServerUI" gui.ResetOnSpawn = false gui.Parent = CoreGui local frame = Instance.new("Frame") frame.Size = UDim2.fromOffset(width, height) frame.Position = UDim2.fromOffset((screen.X - width) / 2, math.max(24, screen.Y * 0.08)) frame.BackgroundColor3 = Color3.fromRGB(15, 15, 20) frame.BorderSizePixel = 0 frame.Parent = gui roundify(frame, 16) local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -24, 0, 42) title.Position = UDim2.new(0, 12, 0, 12) title.BackgroundTransparency = 1 title.Text = "Private Server Joiner" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.GothamBold title.TextSize = 22 title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = frame local subtitle = Instance.new("TextLabel") subtitle.Size = UDim2.new(1, -24, 0, 24) subtitle.Position = UDim2.new(0, 12, 0, 50) subtitle.BackgroundTransparency = 1 subtitle.Text = "Mobile + PC friendly UI" subtitle.TextColor3 = Color3.fromRGB(160, 160, 180) subtitle.Font = Enum.Font.Gotham subtitle.TextSize = 13 subtitle.TextXAlignment = Enum.TextXAlignment.Left subtitle.Parent = frame local function createInput(labelText, y, default) local label = Instance.new("TextLabel") label.Size = UDim2.new(1, -24, 0, 18) label.Position = UDim2.new(0, 12, 0, y) label.BackgroundTransparency = 1 label.Text = labelText label.TextColor3 = Color3.fromRGB(220, 220, 230) label.Font = Enum.Font.GothamSemibold label.TextSize = 13 label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = frame local box = Instance.new("TextBox") box.Size = UDim2.new(1, -24, 0, 38) box.Position = UDim2.new(0, 12, 0, y + 20) box.BackgroundColor3 = Color3.fromRGB(25, 26, 34) box.TextColor3 = Color3.fromRGB(255, 255, 255) box.PlaceholderText = default box.Text = default box.Font = Enum.Font.Gotham box.TextSize = 15 box.ClearTextOnFocus = false box.Parent = frame roundify(box, 10) local stroke = Instance.new("UIStroke") stroke.Color = Color3.fromRGB(60, 60, 75) stroke.Thickness = 1 stroke.Parent = box return box end local placeBox = createInput("Target Place ID", 88, tostring(game.PlaceId)) local codeBox = createInput("Private Server Link or Code", 154, "") local status = Instance.new("TextLabel") status.Size = UDim2.new(1, -24, 0, 48) status.Position = UDim2.new(0, 12, 0, height - 110) status.BackgroundTransparency = 1 status.Text = "Enter the place ID and private server code/link" status.TextColor3 = Color3.fromRGB(180, 200, 255) status.Font = Enum.Font.Gotham status.TextSize = 14 status.TextWrapped = true status.Parent = frame local joinButton = Instance.new("TextButton") joinButton.Size = UDim2.new(1, -24, 0, 50) joinButton.Position = UDim2.new(0, 12, 0, height - 56) joinButton.BackgroundColor3 = Color3.fromRGB(76, 166, 255) joinButton.TextColor3 = Color3.fromRGB(255, 255, 255) joinButton.Text = "Join Private Server" joinButton.Font = Enum.Font.GothamBold joinButton.TextSize = 16 joinButton.Parent = frame roundify(joinButton, 12) local buttonStroke = Instance.new("UIStroke") buttonStroke.Color = Color3.fromRGB(90, 190, 255) buttonStroke.Thickness = 1 buttonStroke.Parent = joinButton -- Draggable window for easier use on mobile/PC local dragging = false local dragStart local startPos frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = frame.Position end end) frame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) frame.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart frame.Position = UDim2.new(0, startPos.X.Offset + delta.X, 0, startPos.Y.Offset + delta.Y) end end) joinButton.MouseButton1Click:Connect(function() local placeId = tonumber(placeBox.Text) local serverCode = parsePrivateServerCode(codeBox.Text) if not placeId or not serverCode then setLabelText(status, "Please enter a valid Place ID and private server code/link.", Color3.fromRGB(255, 120, 120)) return end if game.PlaceId ~= placeId then setLabelText(status, "This server is not the target place. Open the target place first.", Color3.fromRGB(255, 200, 100)) return end local teleportData = TeleportService:GetTeleportData() if teleportData and teleportData.__fromPrivateServerUI then setLabelText(status, "Already joined from this UI.", Color3.fromRGB(120, 255, 120)) return end setLabelText(status, "Trying to join private server...", Color3.fromRGB(150, 220, 255)) local ok, err = pcall(function() TeleportService:TeleportToPrivateServer( placeId, serverCode, {player}, { __fromPrivateServerUI = true } ) end) if ok then setLabelText(status, "Teleport request sent. If nothing happens, the game may block this from client-side execution.", Color3.fromRGB(120, 255, 120)) else setLabelText(status, "Teleport failed: " .. tostring(err), Color3.fromRGB(255, 120, 120)) end end)