I have turned the health coregui off and am trying to make my own gui, but when I run it it displays a bunch of random numbers.
health lower script:
local healthValue = 100 while healthValue > 0 do healthValue = healthValue - 5 game.Players.LocalPlayer.Character.Humanoid.Health = healthValue wait(5) end
health reading script:
local textValue = script.Parent local healthValue = game.Players.LocalPlayer.Character.Humanoid local value = 0 while true do value = healthValue.Health textValue.Text = (value) wait (1) end
I'm not sure why that's displaying random numbers, but your health reading script is woefully inefficient.
Try this code instead, using the HealthChanged
Event of Humanoid. I've also included a safeguards against stuff loading slowly the first time the Character spawns in:
local Player = Game.Players.LocalPlayer if not Player.Character then Player.CharacterAdded:wait() end Player.Character.Humanoid.HealthChanged:connect(function(hp) script.Parent.Text = hp end