Yo! i made a hearth bar that is vertical, it was work but for some reason it sized upward and not downward. I write a code that change the position of the bar to the bottom of the canvas group so when sized it goes downward, when i tested it, it still going upward idk what it did wrong
anyway here is the script
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local gui = script.Parent.Parent
local frame = gui:FindFirstChild("Frame")
local healthFrame = frame:FindFirstChild("HealthFrame")
local bar = healthFrame:FindFirstChild("Bar")
local soundFolder = workspace:FindFirstChild("Sound")
local heartbeat = soundFolder and soundFolder:FindFirstChild("Heartbeat")
local breathing = soundFolder and soundFolder:FindFirstChild("Heavy Breathing")
local function updateHealthDisplay(health)
local ScaleY = bar.Size.Y.Scale
bar.Size = UDim2.new(1, 0, math.clamp(health / 100, 0, 1), 0)
bar.Position = UDim2.new(0, 0, 1 - ScaleY, 0)
end
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
updateHealthDisplay(humanoid.Health)
end)
updateHealthDisplay(humanoid.Health)
and also this
Thanks =D
