The issue is that you are binding your logic to the specific Humanoid instance that exists when the script first runs. In Roblox, when a player resets, that character model (and its Humanoid) is destroyed and replaced with a brand new one.
You aren’t rebinding the connection to the new humanoid, it still tries to read data from the old humanoid.
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local connection = nil
local function bindHumanoidHealth()
if connection then connection:Disconnect() end --// Remove last connection
connection = hum:GetPropertyChangedSignal("Health"):Connect(function() --// Create new connection
script.Parent.Text = math.round(hum.Health)
end
end
plr.CharacterAdded:Connect(function(c)
hum = c:WaitForChild("Humanoid")
bindHumanoidHealth()
end)
bindHumanoidHealth()
Thank you so much mam, today i learned a new lesson. @aydnDEV thanks too, i just didnt understand what you meant first time.
Remember to rebind stuff guys!