Hello, developers!
I’m having a problem with tweening a UI. It’s meant to tween based on the player’s health, but instead of going downwards, it goes upwards:
My code:
local plr = game:GetService("Players").LocalPlayer
repeat wait() until plr.Character or plr.CharacterAdded:wait()
local char = plr.Character or plr.CharacterAdded:wait()
local hum = char:WaitForChild("Humanoid")
local bar = script.Parent.Frame.Holder.Bar
while wait() do
bar:TweenSize(UDim2.new(1, 0,hum.Health/hum.MaxHealth, 0),"Out","Linear",0.2,true)
bar.BackgroundColor3 = Color3.fromRGB(255, 51, 54):Lerp(Color3.fromRGB(17, 255, 104),hum.Health/hum.MaxHealth)
end
Any suggestions are appreciated!