Universal Script 📌
378 Views
27 Executions

Vertical health bar

Universal Script 📌
Zale
ZalePublished 5
6 months ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

View Raw
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local CoreGui = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
 
local function formatHealth(val)
    local rounded = math.round(val * 10) / 10 -- Rounds to 1 decimal place first
    if rounded % 1 == 0 then
        return string.format("%.0f", rounded) -- Absolutely no decimal for whole numbers
    else
        return string.format("%.1f", rounded) -- Exactly one decimal for others
    end
end
 
local function createHealthBar(character)
    local humanoid = character:WaitForChild("Humanoid", 5)
    local head = character:WaitForChild("Head", 5)
    if not humanoid or not head then return end
 
    if CoreGui:FindFirstChild(character.Name .. "_HealthBar") then
        CoreGui[character.Name .. "_HealthBar"]:Destroy()
    end
 
    local billboard = Instance.new("BillboardGui")
    billboard.Name = character.Name .. "_HealthBar"
    billboard.Parent = CoreGui
    billboard.Adornee = head
    billboard.Size = UDim2.new(4, 0, 6, 0) 
    billboard.AlwaysOnTop = true
    billboard.ExtentsOffset = Vector3.new(2.8, 1, 0) -- Far right of head
 
    local mainFrame = Instance.new("Frame")
    mainFrame.Size = UDim2.new(0.06, 0, 0.6, 0) 
    mainFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
    mainFrame.BackgroundTransparency = 0.5
    mainFrame.BorderSizePixel = 0
    mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
    mainFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
    mainFrame.Parent = billboard
 


Comments

1
Log in to join the conversation. Login
dominicanamor809's profile picture
dominicanamor8096 months ago

Love it!! Sleek and new:)

1

More universal scripts

See all
Universal Script 📌
28.3k
663.4k
Bumped 36 minutes ago
Script hub
13.5k
2.7k
Bumped 3 hours ago
Key System
Paid
Script hub
263.1k
88.1k
Bumped 4 hours ago
Key System
Universal Script 📌
2.4k
9.4k
Bumped 4 hours ago
Universal Script 📌
224
30
Approved 4 hours ago
Universal Script 📌
249
26
Approved 4 hours ago
Universal Script 📌
272
9
Approved 4 hours ago