I have a localscript inside a TextLabel, in a frame, inside a Frame, in a ScreenGUI inside the player's playerGUI.
This script is supposed to make the TextLabel's text the players health.
local player = game.Players.LocalPlayer --The local player. local health = player.Character:WaitForChild("Health") --Yields (makes the script wait) until the apples object becomes available. script.Parent.Text= "" .. health.Value health.Changed:connect(function() --Connects a function to an event. Known as an anonymous function (as it has no direct identifier.) script.Parent.Text = "" .. health.Value --Sets the Text property of the script's parent to "Apples: " then the apples variable's value. The two dots are used for string concatenation (merging of values to form a string.) end) --Ends the anonymous function.
Thanks, please post the code in your answer.
Assuming you're trying to find the Humanoid's health, you should use this:
(Also, you don't need to leave other people's comments in, but if you need a reminder, leave them in)
local player = game.Players.LocalPlayer --The local player. local humanoid = player.Character:WaitForChild("Humanoid") --Yields (makes the script wait) until the apples object becomes available. script.Parent.Text= "" .. humanoid.Health humanoid.Changed:connect(function() --Connects a function to an event. Known as an anonymous function (as it has no direct identifier.) script.Parent.Text = "" .. humanoid.Health --Sets the Text property of the script's parent to "Apples: " then the apples variable's value. The two dots are used for string concatenation (merging of values to form a string.) end) --Ends the anonymous function.
Try making changing
local health = player.Character:WaitForChild("Health")
to
local health = player.Character:WaitForChild("Huamnoid")
then do
game.Players.LocalPlayer.Character.Humanoid.Health