I'm creating a health bar in which every time the player's health changes, the bar would go down relative to the player's current health. I have two values in StarterGui.HealthBar. One is called MaxHealth and the other is CurrentHealth.
Here is my script: (LocalScript)
repeat wait() until game.Players.LocalPlayer.Character
local humanoid = game.Players.LocalPlayer.Character:FindFirstChild('Humanoid')
local maxHealth = script.Parent.MaxHealth
local currentHealth = script.Parent.CurrentHealth
local backgroundFrame = script.Parent.Main.BackgroundHealth
local realFrame = backgroundFrame.Health
currentHealth.Changed:Connect(function()
realFrame:TweenSize(UDim2.new(currentHealth / maxHealth,0,1,0),'In','Sine',.2)
end)
However, the value of CurrentHealth is not changing according to the humanoid's health.
Any help?
EDIT: Thanks to PixelRankYT for solving the problem. Apparently the problem was that I didn't use Humanoid.Changed. I never knew that! :OO

4 comments
You need to check if the humanoid changes. NOTE: That's how I seen people do health bars!
How would I do that?
humanoid.Changed:Connect(function()
Oh.