Why isnt it updating when i reset bro

-- local script, inside startergui frame (ResetOnSpawn disabled)
local plr = game.Players.LocalPlayer
local hum = plr.Character:WaitForChild("Humanoid") or plr.CharacterAdded:WaitForChild("Humanoid")

script.Parent.Text = math.round(hum.Health)

plr.CharacterAdded:Connect(function()
	local hum = plr.Character:WaitForChild("Humanoid")
	script.Parent.Text = math.round(hum.Health)
end)

hum:GetPropertyChangedSignal("Health"):Connect(function()
	script.Parent.Text = math.round(hum.Health)
end)

also roblox dont remove classic faces nor r6 im going to get mad you dont wanna see me like that, otherwise i will need to activate plan b

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.

1 Like
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

script.Parent.Text = math.round(hum.Health)

hum:GetPropertyChangedSignal("Health"):Connect(function()
	script.Parent.Text = math.round(hum.Health)
end)

plr.CharacterAppearanceLoaded:Connect(function()
	char = plr.Character
	hum = char:WaitForChild("Humanoid")
	script.Parent.Text = math.round(hum.Health)
end)

kinda fixed it, kinda :-/
*edit: nope, didnt fix it

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()
1 Like

Thank you so much mam, today i learned a new lesson. :derp:
@aydnDEV thanks too, i just didnt understand what you meant first time.
Remember to rebind stuff guys!

1 Like

Haha sorry, probably should’ve explained it in a script. You’re welcome, and thanks @Chark_Proto for assisting him.

1 Like