local player = game.Players.LocalPlayer
local char = player.Character or player.ChildAdded:Wait()
local hum = char:WaitForChild("Humanoid")
function resizeCustomLoadingBar(sizeRatio, clipping, top)
clipping.Size = UDim2.new(clipping.Size.X.Scale, clipping.Size.X.Offset, sizeRatio, clipping.Size.Y.Offset)
top.Size = UDim2.new(top.Size.X.Scale, top.Size.X.Offset, (sizeRatio > 0 and 1 / sizeRatio) or 0, top.Size.Y.Offset)
end
while true do task.wait()
local healthRatio = hum.Health / hum.MaxHealth
resizeCustomLoadingBar(healthRatio, script.Parent.ImageLabel.Clipping, script.Parent.ImageLabel.Clipping.Top)
end
local player = game.Players.LocalPlayer
local char = player.Character or player.ChildAdded:Wait()
local hum = char:WaitForChild("Humanoid")
function resizeCustomLoadingBar(sizeRatio, clipping, top)
-- Update the size and position of the clipping element
clipping.Size = UDim2.new(clipping.Size.X.Scale, clipping.Size.X.Offset, sizeRatio, clipping.Size.Y.Offset)
clipping.Position = UDim2.new(clipping.Position.X.Scale, clipping.Position.X.Offset, 1 - sizeRatio, clipping.Position.Y.Offset)
-- Adjust the top overlay to match the clipping height
top.Size = UDim2.new(top.Size.X.Scale, top.Size.X.Offset, (sizeRatio > 0 and 1 / sizeRatio) or 0, top.Size.Y.Offset)
end
while true do
task.wait()
local healthRatio = hum.Health / hum.MaxHealth
resizeCustomLoadingBar(healthRatio, script.Parent.ImageLabel.Clipping, script.Parent.ImageLabel.Clipping.Top)
end
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
function resizeCustomLoadingBar(sizeRatio, clipping, top)
clipping.Size = UDim2.new(clipping.Size.X.Scale, clipping.Size.X.Offset, sizeRatio, clipping.Size.Y.Offset)
clipping.Position = UDim2.new(clipping.Position.X.Scale, clipping.Position.X.Offset, 1 - sizeRatio, clipping.Position.Y.Offset) -- Adjust position
top.Size = UDim2.new(top.Size.X.Scale, top.Size.X.Offset, (sizeRatio > 0 and 1 / sizeRatio) or 0, top.Size.Y.Offset)
end
while true do
task.wait()
local healthRatio = hum.Health / hum.MaxHealth
resizeCustomLoadingBar(healthRatio, script.Parent.ImageLabel.Clipping, script.Parent.ImageLabel.Clipping.Top)
end