Not sure why this isn't working. The text to display the health just stays to its default set (which is "null") I've also tried (function(health) but that doesn't work either. I've looked at articles, and they didn't help. Here's the script:
--Status
local player = game.Players.LocalPlayer
local HealthNav = script.Parent.Frame.StatusFrame.HealthFrame.Percentage
local HealthPercent = script.Parent.Frame.StatusFrame.HealthFrame.Percentage.Text
local Health = player.Character.Humanoid
player.Character.Humanoid.HealthChanged:Connect(function()
HealthPercent = Health.Health .. "/" .. Health.MaxHealth .. "%"
print(player.Name .. "'s Health is " .. Health.Health .. "/" .. Health.MaxHealth .. "%")
if Health.Health == Health.MaxHealth then
HealthNav.TextColor3 = Color3.new(255/255, 255/255, 255/255)
elseif Health.Health >75 then
HealthNav.TextColor3 = Color3.new(126/255, 255/255, 124/255)
elseif Health.Health <75 and Health.Health >25 then
HealthNav.TextColor3 = Color3.new(255/255, 202/255, 41/255)
elseif Health.Health <25 then
HealthNav.TextColor3 = Color3.new(255/255, 53/255, 53/255)
end
end)
The colors work, the print works, but not the HealthPercent. Can someone please explain this? It would be appreciated.

4 comments
Usually I would use a remote event to deal damage but to me, I can't really see what is wrong. Are there any errors in console?
No errors in the Output. The test just displays "null" as a red text, since I set my health to 1.
what this script needed for?
To display the localplayers health inside a Gui.