So this script is meant to use the value of an IntValue I created to decide how big or small the health bar I have created is (the healthbar is a gui, health is inside the localplayer)
this works, in fact, the script runs without errors. But it only changes the size of the gui once and that is to whatever i predetermine the health value to be before I run the game. Any reason for this? Am I calling for anything improperly/does something I call change locations post-player connection?
Here is my code, any help is appreciated:
local player=game.Players.LocalPlayer
local health=player.Health.Value
local mana=player.Mana.Value
local character=player.Character
local function changeHealth()
local health_frame=script.Parent.Gui.Frame.healthFrame
health_frame.Size = UDim2.new(0, health, 0, 20)
print("Done")
end
while wait(.1) do
changeHealth()
end

1 comment
Sorry for such a late response, just woke up! But thank you! I was not that aware of the importance of where you call the function it works great now.