I'm trying to make a health bar gui that tweens from the start color (green) at full health to red at 0 health. The script is in a Frame. (It's a local script)

wait(1)
print("worked")


local player = game.Players.LocalPlayer
local character = player.Character
local hum = character.Humanoid
local over = script.Parent.Overlay
local under = script.Parent

function update()
	
	local hp = hum.Health / hum.MaxHealth
	
	over:TweenSize(UDim2.new(hp,0,1,0), "InOut", "Linear", wait(.35), .6)
	wait(.1)
	--Where the Color tween goes
	wait(1)
end

update()

hum.HealthChanged:connect(update)

It doesn't have to use TweenService, as long as it smoothly changes color with the player's health.

2 comments

0

use lerp

0

Remove the wait, and just do .35, also probably cause it tweens to fast so do .75