An actual healthbar script
Key Required

An actual healthbar script

The Battle BricksAbsolutelyNoIdeaAbsolutelyNoIdea 902 views 8K executesUpdated Jul 7, 2026
5.0/ 5(3 votes)
30100% Positive
Lua Script•70 lines (2125 chars)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:FindFirstChild("Events")
local RemoteEvents = Events:FindFirstChild("RemoteEvents")
local AddHPBars = RemoteEvents:FindFirstChild("AddHPBars")
local Workspace = game:GetService("Workspace")
local CollectionService = game:GetService("CollectionService")

local NPCFolders = Workspace:FindFirstChild("NPCFolders")
local FriendlyFolder = NPCFolders:FindFirstChild("FriendlyFolder")
local EnemyFolder = NPCFolders:FindFirstChild("EnemyFolder")

local ProcessedNPCs = {}

local function GetHealthbarType(npc, defaultBarType)
    if CollectionService:HasTag(npc, "Friendly") then
        return "Friendly"
    end
    if CollectionService:HasTag(npc, "Boss") then
        return "Boss"
    end
    return defaultBarType
end

local function ApplyHealthbarToNPC(npc, defaultBarType)
    if npc and not ProcessedNPCs[npc] then
        ProcessedNPCs[npc] = true
        task.spawn(function()
            local head = npc:WaitForChild("Head", 5)
            local humanoid = npc:WaitForChild("Humanoid", 5)

            if head and humanoid then
                local barType = GetHealthbarType(npc, defaultBarType)

                pcall(function()
                    firesignal(AddHPBars.OnClientEvent, npc, barType, head)
                end)
            else
                ProcessedNPCs[npc] = nil
            end
        end)
    end
end

if FriendlyFolder then
    task.spawn(function()
        local children = FriendlyFolder:GetChildren()
        for _, npc in ipairs(children) do
            ApplyHealthbarToNPC(npc, "Friendly")
            task.wait(0.02)
        end
    end)

    FriendlyFolder.ChildAdded:Connect(function(npc)
        ApplyHealthbarToNPC(npc, "Friendly")
    end)
end

if EnemyFolder then
    task.spawn(function()
        local children = EnemyFolder:GetChildren()
        for _, npc in ipairs(children) do
            ApplyHealthbarToNPC(npc, "Enemy")
            task.wait(0.02)
        end
    end)

    EnemyFolder.ChildAdded:Connect(function(npc)
        ApplyHealthbarToNPC(npc, "Enemy")
    end)
end

Features & Information

Self explanatory, shows the healthbar A question you will probably ask Why did you make a healthbar script if you already made one? Simple, it sucked, and this one shows the ACTUAL healthbar from the battle bricks.
#tbb

Community Comments (3)

colitapepe0colitapepe0Jul 8, 2026

By chance why do I want a health bar if I end up losing anyway

Replying to @colitapepe0
TbbuserTbbuserSep 5, 2026

@colitapepe0 because if you want to see a boss health for example, if u use this you can

Replying to @Tbbuser
Evil_S*sEvil_S*sSep 5, 2026

@Tbbuser True this is quite Useful.

More Scripts for The Battle Bricks