Hey guys!
I wanted to show the health of a player, in a gui. I can't seem to access it.
text = script.Parent
text.Text = game.Players.LocalPlayer.Health
The result is an error. Any ideas?
Hey guys!
I wanted to show the health of a player, in a gui. I can't seem to access it.
text = script.Parent
text.Text = game.Players.LocalPlayer.Health
The result is an error. Any ideas?
The issue is that you are looking for the health inside the player. To easily access the character from the local player quite simple! Just do this
text = script.Parent
text.Text = game.Players.LocalPlayer.Character.Humanoid.Health
Is this a local script? Also make sure you didn't make a typo. The humanoid should exist unless there's some script that deletes it. And in that case you can't really get the health on the player.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Whats the error?
change line 3 to text.Text = game.Players.LocalPlayer.Character.Humanoid.Health