I have a local script that fires a server event to my server script when the player’s health is <= 0, the problem I’m having is my code is saying that the Frame is not being found but I cannot figure out why. I’m using an alt account on my phone and when in-game I’m resetting the player on my phone, which is TedsTestingAcct. What I want to have happen is for the “Dead” text at the top to become visible for the players.
This is a picture of what the Frames look like with their proper names matching the player’s names:

This is the code:
Local script:
local function UpdateHealthBar()
print("Changed")
local health = math.clamp(Character:WaitForChild('Humanoid').Health / Character:WaitForChild('Humanoid').MaxHealth, 0, 1) --Maths
local info = TweenInfo.new(Character:WaitForChild('Humanoid').Health / Character:WaitForChild('Humanoid').MaxHealth,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info
TweenService:Create(script.Parent:WaitForChild('Juice'),info,{Size = UDim2.fromScale(health, 1)}):Play() -- Create The Tween Then Play It
if Character:WaitForChild('Humanoid').Health >= 0 then
print(player.Name .. " has died.")
PlayerDiedRemote:FireServer(player)
end
end
Server Script:
PlayerDiedRemote.OnServerEvent:Connect(function(player)
print(player.Name .. " has died.")
local gameHUD = player:WaitForChild('PlayerGui').MainGame.GameHUD
local playerGuiElement = gameHUD.Players:FindFirstChild(player.Name)
if gameHUD then
print("Yes")
else
print("No")
end
if playerGuiElement then
print("Found GUI element for: " .. player.Name)
playerGuiElement.Dead.Visible = true
else
print("GUI element not found for: " .. player.Name)
end
end)
This is the output I keep getting:

Why is it not finding the GUI Element?
