File size: 6,653 Bytes
0712d5f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | -- src/StarterGui/MainHUD.client.lua
-- Full in-game HUD: cash display, equipped tool, minimap frame, hotbar, weather indicator
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local Utility = require(ReplicatedStorage:WaitForChild("Shared"):WaitForChild("Utility"))
-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "MainHUD"
screenGui.ResetOnSpawn = false
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
screenGui.Parent = player:WaitForChild("PlayerGui")
-- ========== TOP BAR ==========
local topBar = Instance.new("Frame")
topBar.Name = "TopBar"
topBar.Size = UDim2.new(1, 0, 0, 50)
topBar.Position = UDim2.new(0, 0, 0, 0)
topBar.BackgroundColor3 = Color3.fromRGB(20, 25, 30)
topBar.BackgroundTransparency = 0.3
topBar.BorderSizePixel = 0
topBar.Parent = screenGui
local topCorner = Instance.new("UICorner")
topCorner.CornerRadius = UDim.new(0, 0)
topCorner.Parent = topBar
-- Cash Display
local cashFrame = Instance.new("Frame")
cashFrame.Name = "CashFrame"
cashFrame.Size = UDim2.new(0, 200, 0, 40)
cashFrame.Position = UDim2.new(0, 10, 0, 5)
cashFrame.BackgroundColor3 = Color3.fromRGB(40, 120, 40)
cashFrame.BackgroundTransparency = 0.3
cashFrame.BorderSizePixel = 0
cashFrame.Parent = topBar
local cashCorner = Instance.new("UICorner")
cashCorner.CornerRadius = UDim.new(0, 8)
cashCorner.Parent = cashFrame
local cashIcon = Instance.new("TextLabel")
cashIcon.Name = "CashIcon"
cashIcon.Size = UDim2.new(0, 30, 1, 0)
cashIcon.Position = UDim2.new(0, 5, 0, 0)
cashIcon.BackgroundTransparency = 1
cashIcon.Text = "$"
cashIcon.TextColor3 = Color3.fromRGB(255, 215, 0)
cashIcon.TextScaled = true
cashIcon.Font = Enum.Font.GothamBold
cashIcon.Parent = cashFrame
local cashLabel = Instance.new("TextLabel")
cashLabel.Name = "CashLabel"
cashLabel.Size = UDim2.new(1, -40, 1, 0)
cashLabel.Position = UDim2.new(0, 38, 0, 0)
cashLabel.BackgroundTransparency = 1
cashLabel.Text = "0"
cashLabel.TextColor3 = Color3.new(1, 1, 1)
cashLabel.TextScaled = true
cashLabel.Font = Enum.Font.GothamBold
cashLabel.TextXAlignment = Enum.TextXAlignment.Left
cashLabel.Parent = cashFrame
-- Wood Chopped Display
local woodFrame = Instance.new("Frame")
woodFrame.Name = "WoodFrame"
woodFrame.Size = UDim2.new(0, 180, 0, 40)
woodFrame.Position = UDim2.new(0, 220, 0, 5)
woodFrame.BackgroundColor3 = Color3.fromRGB(120, 80, 40)
woodFrame.BackgroundTransparency = 0.3
woodFrame.BorderSizePixel = 0
woodFrame.Parent = topBar
local woodCorner = Instance.new("UICorner")
woodCorner.CornerRadius = UDim.new(0, 8)
woodCorner.Parent = woodFrame
local woodLabel = Instance.new("TextLabel")
woodLabel.Name = "WoodLabel"
woodLabel.Size = UDim2.new(1, -10, 1, 0)
woodLabel.Position = UDim2.new(0, 10, 0, 0)
woodLabel.BackgroundTransparency = 1
woodLabel.Text = "Wood: 0"
woodLabel.TextColor3 = Color3.new(1, 1, 1)
woodLabel.TextScaled = true
woodLabel.Font = Enum.Font.GothamMedium
woodLabel.TextXAlignment = Enum.TextXAlignment.Left
woodLabel.Parent = woodFrame
-- Equipped Tool Display
local toolFrame = Instance.new("Frame")
toolFrame.Name = "ToolFrame"
toolFrame.Size = UDim2.new(0, 180, 0, 40)
toolFrame.Position = UDim2.new(0.5, -90, 0, 5)
toolFrame.AnchorPoint = Vector2.new(0, 0)
toolFrame.BackgroundColor3 = Color3.fromRGB(60, 60, 80)
toolFrame.BackgroundTransparency = 0.3
toolFrame.BorderSizePixel = 0
toolFrame.Parent = topBar
local toolCorner = Instance.new("UICorner")
toolCorner.CornerRadius = UDim.new(0, 8)
toolCorner.Parent = toolFrame
local toolLabel = Instance.new("TextLabel")
toolLabel.Name = "ToolLabel"
toolLabel.Size = UDim2.new(1, -10, 1, 0)
toolLabel.Position = UDim2.new(0, 10, 0, 0)
toolLabel.BackgroundTransparency = 1
toolLabel.Text = "Axe: BasicAxe"
toolLabel.TextColor3 = Color3.new(1, 1, 1)
toolLabel.TextScaled = true
toolLabel.Font = Enum.Font.GothamMedium
toolLabel.TextXAlignment = Enum.TextXAlignment.Center
toolLabel.Parent = toolFrame
-- Weather Display
local weatherFrame = Instance.new("Frame")
weatherFrame.Name = "WeatherFrame"
weatherFrame.Size = UDim2.new(0, 140, 0, 40)
weatherFrame.Position = UDim2.new(1, -150, 0, 5)
weatherFrame.BackgroundColor3 = Color3.fromRGB(50, 70, 100)
weatherFrame.BackgroundTransparency = 0.3
weatherFrame.BorderSizePixel = 0
weatherFrame.Parent = topBar
local weatherCorner = Instance.new("UICorner")
weatherCorner.CornerRadius = UDim.new(0, 8)
weatherCorner.Parent = weatherFrame
local weatherLabel = Instance.new("TextLabel")
weatherLabel.Name = "WeatherLabel"
weatherLabel.Size = UDim2.new(1, -10, 1, 0)
weatherLabel.Position = UDim2.new(0, 5, 0, 0)
weatherLabel.BackgroundTransparency = 1
weatherLabel.Text = "Clear"
weatherLabel.TextColor3 = Color3.new(1, 1, 1)
weatherLabel.TextScaled = true
weatherLabel.Font = Enum.Font.GothamMedium
weatherLabel.TextXAlignment = Enum.TextXAlignment.Center
weatherLabel.Parent = weatherFrame
-- ========== HOTBAR HINTS ==========
local hintsFrame = Instance.new("Frame")
hintsFrame.Name = "ControlHints"
hintsFrame.Size = UDim2.new(0, 400, 0, 30)
hintsFrame.Position = UDim2.new(0.5, -200, 1, -40)
hintsFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
hintsFrame.BackgroundTransparency = 0.5
hintsFrame.BorderSizePixel = 0
hintsFrame.Parent = screenGui
local hintsCorner = Instance.new("UICorner")
hintsCorner.CornerRadius = UDim.new(0, 6)
hintsCorner.Parent = hintsFrame
local hintsLabel = Instance.new("TextLabel")
hintsLabel.Size = UDim2.new(1, -10, 1, 0)
hintsLabel.Position = UDim2.new(0, 5, 0, 0)
hintsLabel.BackgroundTransparency = 1
hintsLabel.Text = "[Click] Punch/Chop [B] Build [C] Craft [I] Inventory [P] Shop [L] Quests [M] Market [O] Settings"
hintsLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
hintsLabel.TextScaled = true
hintsLabel.Font = Enum.Font.Gotham
hintsLabel.Parent = hintsFrame
-- ========== UPDATE LOOP ==========
RunService.Heartbeat:Connect(function()
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local cash = leaderstats:FindFirstChild("Cash")
if cash then
cashLabel.Text = Utility.formatCash(cash.Value)
end
local wood = leaderstats:FindFirstChild("WoodChopped")
if wood then
woodLabel.Text = "Wood: " .. tostring(wood.Value)
end
end
-- Update equipped tool display
local axeType = player:GetAttribute("EquippedAxe") or "BasicAxe"
toolLabel.Text = "Axe: " .. axeType
end)
|