Complete Roblox HUD: Health, Coins, Minimap, and Alerts
Generate a professional, modular HUD for Roblox experiences, bringing together health, currency, minimap, and notifications in a single responsive interface. The prompt guides the AI to adapt the code to the real structure of your project, including RemoteEvent names, map folders, attributes, and existing objects in the Explorer.
The expected result is a complete, commented Luau LocalScript ready to paste into Roblox Studio. It prioritizes efficient updates, compatibility with keyboard, mouse, touch, and gamepad, and clearly separates local presentation from data that must remain authoritative on the server.
Ideal for developers who already have or plan to implement economy, combat, and server event systems, but need a solid, scalable, and easy-to-configure visual layer on the client.
Act as a senior Roblox developer, specializing in Luau, UI/UX for games, performance, and secure client-server architecture. Generate a complete HUD system for Roblox in a single **LocalScript**, ready to be pasted into Studio. Before producing the code, consider and use the context of my project below. If any item is not provided, use the default names defined in the script settings section and leave clear comments showing where to change them: [PASTE MY GAME CONTEXT HERE] - Name and path of the existing ScreenGui (if any): - Should the HUD create its own interface or fill existing Frames?: - Name/location of the folder or model of the map for the minimap: - Parts that should be ignored in the minimap (e.g., decoration, effects): - Name of the notifications RemoteEvent in ReplicatedStorage: - How the currency is replicated to the player (Attribute, IntValue, leaderstats, Data folder, etc.) and its respective path: - If there are images/asset IDs for health, currency, player, and notification icons: - Desired color palette, font, and visual style: - Maximum limit of simultaneous notifications: - Other specific rules: [END OF CONTEXT] ### Script type and location Produce **only one LocalScript**, which must be placed in **StarterPlayer > StarterPlayerScripts**. The script must create and manage a `ScreenGui` in the player's `PlayerGui`. Do not deliver pseudocode, incomplete snippets, multiple files, or undeclared mandatory dependencies. If I have provided an existing GUI, allow it to be selected by configuration; otherwise, create the entire visual hierarchy through code. ### Required features 1. **Health:** correctly track `Humanoid.Health` and `Humanoid.MaxHealth` for the current character. Reconnect everything after respawn using `CharacterAdded`. Display an optional numeric value, a bar with smooth fill via TweenService, and visual states for low health. Never change health from the client. 2. **Currency:** read only one value replicated by the server, supporting by configuration `Attribute`, `IntValue/NumberValue`, or `leaderstats`. Update the UI when the value changes, format large numbers (e.g., 1.2K, 3.4M), and animate the visual transition. The client must never grant, deduct, or determine currency. 3. **Minimap:** implement a local minimap using `ViewportFrame`, safely cloning the visual elements from a configurable folder/model in `Workspace`. Use `WorldModel` and a dedicated camera. Place a local marker for the player, update rotation/position efficiently in `RenderStepped`, limit the rendered area when applicable, and do not clone scripts, unnecessary constraints, or dangerous objects. If the provided map is too complex for direct cloning, document in the code a filtering strategy based on tags/attributes and a scale configuration. 4. **Notifications:** listen to an existing `RemoteEvent` in `ReplicatedStorage` only to receive notifications sent by the server. Create a queue with configurable limit, entry/exit animations, configurable duration, `success`, `warning`, `error`, and `info` categories, and protection against local spam. Also provide a reusable local function `ShowNotification(title, message, type, duration)` for purely visual client-side events. 5. **Responsiveness:** use `UIScale`, `UIAspectRatioConstraint`, `AnchorPoint`, proportional sizes, and `TextScaled` with appropriate limits for desktop, mobile, and gamepad. Respect `GuiService:GetGuiInset()` when necessary. The interface must be easy to read and must not capture game input unless needed. ### Security and quality The server is authoritative. Do not create RemoteEvents automatically and do not use `FireServer` for health, currency, inventory, damage, or any sensitive state. Every RemoteEvent/RemoteFunction that receives data from the client must be validated on the server (type, limits, permissions, distance, and cooldown); mention this in the relevant comments, even if this HUD only consumes replicated data and server notifications. Use `WaitForChild` with timeouts when appropriate, organized connections, cleanup of connections on respawn when necessary, and `pcall` only where there is a real justification. Avoid unnecessary `while true do` loops and expensive UI updates. ### Required response format First respond with a brief explanation of the architecture and the assumptions used. Then provide the **full, functional, well-commented Luau code in a single markdown block ` ```lua `**. After the code, provide concise instructions for: configuring the references at the top of the script, creating/testing the notifications RemoteEvent on the server, testing respawn, currency changes, the minimap, and responsiveness in Roblox Studio Play mode. If any context information is missing, do not ask questions: implement a clearly labeled default configuration.