Humanoid Died is not firing under PlayerGui

I have this very simple local script located under a ScreenGui in PlayerGui. But it is not printing “Dead” when the Humanoid dies. I’m unsure why this is the case.

It works when the local script is in StarterCharacterScripts, but not under PlayerGui?

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")

local function OnDeath()
     print("Dead Now")
end

Humanoid.Died:Connect(OnDeath)

It works for me in StarterGui.

2 Likes

hm that’s weird. Lemme try again.

Ah it was at the bottom of my big script line. That’s why. I have a total of 900 lines and so it can’t detect because it’s too big.