Hi, I wanted to make a boss health bar where it has a red bar and a orange bar. If you’v seen some videos of peoples fighting bosses in Ultrakill, you can notice that if the player keeps hitting the boss over and over, the orange bar stays put until the combo is over in which it aligns with the red bar.
I wanted to do the same but how would I do it? I used coroutine to start off but I’m kind of lost.
I know the topic sounds confusing but I’ll simplify it if you want me to.
Some coding I made just to test.
local orangehp = script.Parent.Frame.OrangeHP
local redhp = orangehp.Parent.RedHP
local bosshumanoid : Humanoid = script.Parent.BossHumanoid.Value
local ts = game:GetService("TweenService")
local loaded = false
local co = coroutine.create(function()
loaded = true
task.wait(1)
ts:Create(orangehp, TweenInfo.new(0.6, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(bosshumanoid.Health/bosshumanoid.MaxHealth, 1)}):Play()
end)
local function healthdrop()
ts:Create(redhp, TweenInfo.new(0.6, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(bosshumanoid.Health/bosshumanoid.MaxHealth, 1)}):Play()
coroutine.resume(co)
end
bosshumanoid.HealthChanged:Connect(healthdrop)
This is incomplete so I’m just reaching out.