That's my script :
local Players = game:GetService("Players").LocalPlayer local Character = Players:FindFirstChild("Character") local Humanoid = Character:FindFirstChild("Humanoid")
function Health() script.Parent.Text = tostring(Humanoid.Health.."Health") end Health() Humanoid.Health.Changed:Connect(Health)
That's basically my script somewhy it doesn't work, Thanks for helping
Well, there were few flaws in your code. I edited all of them and it might work. Comments are also added what's wrong.
local Players = game:GetService("Players").LocalPlayer -- local Character = Players:FindFirstChild("Character") Well, don't just find Character of the player, the Character takes some time to load repeat wait() until Players.Character -- Waits for the Character to load completely local Humanoid = Players.Character:FindFirstChild("Humanoid") function Health() script.Parent.Text = tostring(Humanoid.Health.." Health") end Health() -- Humanoid.Health.Changed:Connect(Health) Don't use Health.Changed, roblox have in-built function to detect the Change in Health, it is called 'HealthChanged' Humanoid.HealthChanged:Connect(Health)
Lemme know if it helps!