Had an interest how those devs to that effect, so whenever your bar goes down it shows likely how much it drains with showing white arena on it like dis
![]()
It will fit my games so hard
Ty for help! If any info needed about what do i mean feel free to ask!
Put frame on 1 zindex layer lower and tween it from previous health to now current.
Cache variable “previous health” somewhere outside of Healthchanged scope and in the end of healthchanged update the variable
Thanks! Realized how to do that, I kinda use old HP Size instead of getting new and old hp which makes it a lot of times easier, just a bit of math and its done.
If anyone needs the script here it
local oldHPSize = UDim2.new(0,0,0,0)
local oldHP = 100
hum.HealthChanged:Connect(function(hp)
if hp < oldHP then
local bar = path --your hpbar
local drainFrame = path --your drain Frame
drainFrame.Transparency = 0
oldHPSize = bar.Size
bar.Size = UDim2.new(hum.Health/hum.MaxHealth,0,1,0)
drainFrame.Size = UDim2.new(oldHPSize.X.Scale-bar.Size.X.Scale,0,1,0)
drainFrame.Position = UDim2.new(bar.Size.X.Scale,0,0,0)
game.TweenService:Create(drainFrame,TweenInfo.new(.4),{Transparency = 1}):Play()
end
oldHP = hp
end)
Jst correct it for a bit and it will be ok
For stamina bar im using smth like this
local drainBar = plr.PlayerGui:WaitForChild("MainUI").PlayerUI.Bars.StaminaBar.drainFrame
drainBar.Position = UDim2.new(bar.Size.X.Scale)
if shift and hum.MoveDirection ~= Vector3.zero and move.stamina>0 then
game.TweenService:Create(drainBar,TweenInfo.new(.5),{Size = UDim2.new(move.staminalosspersec/120,0,1,0)}):Play()
else
game.TweenService:Create(drainBar,TweenInfo.new(.5),{Size = UDim2.new(0,0,1,0)}):Play()
end
Not gonna tell you how my movement system works, just showing yall example
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.