Why is this not changing the frame

When the player dies it’s supposed to make the frame visible which is just a black frame that covers the players screen.

It’s not working at all with the OnClientEvent.


script:WaitForChild("Death").OnClientEvent:Connect(function()
	game.StarterGui.Dead.Frame.BackgroundTransparency = 0
	wait(5)
	game.StarterGui.Dead.Frame.BackgroundTransparency = 1
end)

StarterGui doesn’t contain the GUI items whenever you play, they are replicated into the PlayerGui which is accessible VIA each Players PlayerObject

local Plr = game:GetService("Players").LocalPlayer;
local PlrUI = Plr:WaitForChild("PlayerGui");
local Dead = PlrUI:WaitForChild("Dead");

Plus, why depend on a remote event on death? You’re not passing any information. You can also detect if a humanoid died on the client.

Thanks the reason I’m using OnClientEvent is because I’m doing something in the server before I turn on the GUI.