Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tweening color with health?

Asked by 5 years ago

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.

0
use lerp radusavin366 617 — 5y
0
Remove the wait, and just do .35, also probably cause it tweens to fast so do .75 Next_Byte 21 — 5y

Answer this question