-- src/StarterGui/QuestGUI.client.lua -- Quest log panel with progress bars local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = Players.LocalPlayer local QuestConfig = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("QuestConfig")) local QuestUpdateEvent = ReplicatedStorage:WaitForChild("Events"):WaitForChild("QuestUpdateEvent") local screenGui = Instance.new("ScreenGui") screenGui.Name = "QuestGUI" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local mainFrame = Instance.new("Frame") mainFrame.Name = "QuestFrame" mainFrame.Size = UDim2.new(0, 350, 0, 400) mainFrame.Position = UDim2.new(1, -360, 0, 60) mainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 35) mainFrame.BackgroundTransparency = 0.05 mainFrame.BorderSizePixel = 0 mainFrame.Visible = false mainFrame.Parent = screenGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 12) corner.Parent = mainFrame local stroke = Instance.new("UIStroke") stroke.Color = Color3.fromRGB(200, 180, 60) stroke.Thickness = 2 stroke.Parent = mainFrame local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 40) titleBar.BackgroundColor3 = Color3.fromRGB(120, 100, 30) titleBar.BorderSizePixel = 0 titleBar.Parent = mainFrame local titleCorner = Instance.new("UICorner") titleCorner.CornerRadius = UDim.new(0, 12) titleCorner.Parent = titleBar local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, -50, 1, 0) titleLabel.Position = UDim2.new(0, 15, 0, 0) titleLabel.BackgroundTransparency = 1 titleLabel.Text = "Quest Log" titleLabel.TextColor3 = Color3.new(1, 1, 1) titleLabel.TextScaled = true titleLabel.Font = Enum.Font.GothamBold titleLabel.TextXAlignment = Enum.TextXAlignment.Left titleLabel.Parent = titleBar local closeBtn = Instance.new("TextButton") closeBtn.Size = UDim2.new(0, 30, 0, 30) closeBtn.Position = UDim2.new(1, -35, 0, 5) closeBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50) closeBtn.Text = "X" closeBtn.TextColor3 = Color3.new(1, 1, 1) closeBtn.TextScaled = true closeBtn.Font = Enum.Font.GothamBold closeBtn.Parent = titleBar local closeCorner = Instance.new("UICorner") closeCorner.CornerRadius = UDim.new(0, 6) closeCorner.Parent = closeBtn closeBtn.MouseButton1Click:Connect(function() mainFrame.Visible = false end) local scrollFrame = Instance.new("ScrollingFrame") scrollFrame.Size = UDim2.new(1, -20, 1, -55) scrollFrame.Position = UDim2.new(0, 10, 0, 45) scrollFrame.BackgroundColor3 = Color3.fromRGB(15, 15, 22) scrollFrame.BorderSizePixel = 0 scrollFrame.ScrollBarThickness = 6 scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0) scrollFrame.Parent = mainFrame local scrollCorner = Instance.new("UICorner") scrollCorner.CornerRadius = UDim.new(0, 8) scrollCorner.Parent = scrollFrame local listLayout = Instance.new("UIListLayout") listLayout.SortOrder = Enum.SortOrder.LayoutOrder listLayout.Padding = UDim.new(0, 6) listLayout.Parent = scrollFrame local scrollPadding = Instance.new("UIPadding") scrollPadding.PaddingTop = UDim.new(0, 5) scrollPadding.PaddingLeft = UDim.new(0, 5) scrollPadding.PaddingRight = UDim.new(0, 5) scrollPadding.Parent = scrollFrame local questCards = {} -- [questId] = cardFrame local function createQuestCard(questId, questDef, progress, target, completed) if questCards[questId] then -- Update existing local card = questCards[questId] local progressBar = card:FindFirstChild("ProgressFill") local progressLabel = card:FindFirstChild("ProgressLabel") if progressBar then progressBar.Size = UDim2.new(math.clamp(progress / target, 0, 1), 0, 1, 0) progressBar.BackgroundColor3 = completed and Color3.fromRGB(60, 180, 60) or Color3.fromRGB(60, 120, 200) end if progressLabel then progressLabel.Text = completed and "COMPLETE" or (tostring(progress) .. " / " .. tostring(target)) end return end local card = Instance.new("Frame") card.Name = questId card.Size = UDim2.new(1, 0, 0, 70) card.BackgroundColor3 = completed and Color3.fromRGB(30, 50, 30) or Color3.fromRGB(35, 38, 48) card.BorderSizePixel = 0 card.Parent = scrollFrame local cardCorner = Instance.new("UICorner") cardCorner.CornerRadius = UDim.new(0, 8) cardCorner.Parent = card local nameLabel = Instance.new("TextLabel") nameLabel.Size = UDim2.new(1, -10, 0, 20) nameLabel.Position = UDim2.new(0, 5, 0, 5) nameLabel.BackgroundTransparency = 1 nameLabel.Text = questDef.Title nameLabel.TextColor3 = completed and Color3.fromRGB(100, 255, 100) or Color3.new(1, 1, 1) nameLabel.TextScaled = true nameLabel.Font = Enum.Font.GothamBold nameLabel.TextXAlignment = Enum.TextXAlignment.Left nameLabel.Parent = card local descLabel = Instance.new("TextLabel") descLabel.Size = UDim2.new(1, -10, 0, 15) descLabel.Position = UDim2.new(0, 5, 0, 25) descLabel.BackgroundTransparency = 1 descLabel.Text = questDef.Description descLabel.TextColor3 = Color3.fromRGB(170, 170, 180) descLabel.TextScaled = true descLabel.Font = Enum.Font.Gotham descLabel.TextXAlignment = Enum.TextXAlignment.Left descLabel.Parent = card -- Progress bar background local progressBg = Instance.new("Frame") progressBg.Name = "ProgressBg" progressBg.Size = UDim2.new(0.7, 0, 0, 12) progressBg.Position = UDim2.new(0, 5, 1, -18) progressBg.BackgroundColor3 = Color3.fromRGB(20, 20, 25) progressBg.BorderSizePixel = 0 progressBg.Parent = card local bgCorner = Instance.new("UICorner") bgCorner.CornerRadius = UDim.new(0, 4) bgCorner.Parent = progressBg local progressFill = Instance.new("Frame") progressFill.Name = "ProgressFill" progressFill.Size = UDim2.new(math.clamp(progress / target, 0, 1), 0, 1, 0) progressFill.BackgroundColor3 = completed and Color3.fromRGB(60, 180, 60) or Color3.fromRGB(60, 120, 200) progressFill.BorderSizePixel = 0 progressFill.Parent = progressBg local fillCorner = Instance.new("UICorner") fillCorner.CornerRadius = UDim.new(0, 4) fillCorner.Parent = progressFill -- Progress text local progressLabel = Instance.new("TextLabel") progressLabel.Name = "ProgressLabel" progressLabel.Size = UDim2.new(0.25, 0, 0, 12) progressLabel.Position = UDim2.new(0.75, 0, 1, -18) progressLabel.BackgroundTransparency = 1 progressLabel.Text = completed and "COMPLETE" or (tostring(progress) .. " / " .. tostring(target)) progressLabel.TextColor3 = completed and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(180, 180, 180) progressLabel.TextScaled = true progressLabel.Font = Enum.Font.GothamMedium progressLabel.TextXAlignment = Enum.TextXAlignment.Right progressLabel.Parent = card questCards[questId] = card task.wait() scrollFrame.CanvasSize = UDim2.new(0, 0, 0, listLayout.AbsoluteContentSize.Y + 15) end -- Handle quest events from server QuestUpdateEvent.OnClientEvent:Connect(function(action, data) if action == "Init" then for questId, state in pairs(data) do local questDef = QuestConfig.Quests[questId] if questDef then createQuestCard(questId, questDef, state.progress, questDef.Target, state.completed) end end elseif action == "Update" then local questDef = QuestConfig.Quests[data.questId] if questDef then createQuestCard(data.questId, questDef, data.progress, data.target, data.completed) end end end) -- Toggle with L key UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.L then mainFrame.Visible = not mainFrame.Visible end end)