Screengui wont be visible!

Hello !
Im actually making a death screen system, and when the server fire the client, it could display the death screen but actually it doesnt work and i dont know why !

local button = script.Parent
local player = game.Players.LocalPlayer
local guiDeath = game.StarterGui.DeathScreen
local replicatedStorage = game.ReplicatedStorage
local guiMenu = game.StarterGui.Main

print("ALLEZ MON REUdF")

replicatedStorage.Events.deathClient.OnClientEvent:Connect(function(player)
    print("ALLEZ MON REUF")
    guiDeath.Enabled = true
    guiMenu.Enabled = false
end)

and i dont know why but its not working

You must use PlayerGui if you modify something on the player’s screen

local button = script.Parent
local player = game:GetService("Players").LocalPlayer
local guiDeath = player.PlayerGui.DeathScreen
local replicatedStorage = game:GetService("ReplicatedStorage")
local guiMenu = player.PlayerGui.Main

print("ALLEZ MON REUdF")

replicatedStorage.Events.deathClient.OnClientEvent:Connect(function()
	print("ALLEZ MON REUF")
	guiDeath.Enabled = true
	guiMenu.Enabled = false
end)
1 Like

hum maybe but i got this error : image

Maybe it was not added on time, use WaitForChild

local button = script.Parent
local player = game:GetService("Players").LocalPlayer
local guiDeath = player.PlayerGui:WaitForChild("DeathScreen")
local replicatedStorage = game:GetService("ReplicatedStorage")
local guiMenu = player.PlayerGui:WaitForChild("Main")

print("ALLEZ MON REUdF")

replicatedStorage.Events.deathClient.OnClientEvent:Connect(function()
	print("ALLEZ MON REUF")
	guiDeath.Enabled = true
	guiMenu.Enabled = false
end)
1 Like

you’re a genius it been like 2h and i dont find it THANK YOU SO MUCH

1 Like