How do I script a basic death screen?

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)

char.Humanoid.Died:Connect(function()
   plr.PlayerGui.GUINAME.Enabled = true 
   wait(3)
   plr.PlayerGui.GUINAME.Enabled = false
end)

end)
end)

just do something like this

But you see it needs to have a respawn button.

I just made a simple and quick system right now and I’ll release my scripts on how I did it, here it is:
Make sure to add RemoteEvent inside of ReplicatedStorage you can change name if you want but make sure that you also do inside scripts.

Script in ServerScriptService:

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent",4)


game:GetService('Players').PlayerAdded:Connect(function(player)
    game:GetService("Players").CharacterAutoLoads = true
	player.CharacterAdded:Connect(function(character)
		game:GetService("Players").CharacterAutoLoads = false
		character:WaitForChild("Humanoid").Died:Connect(function()
            --Change here location to your dead screen frame or button as I did.
			player.PlayerGui:FindFirstChild("DeadScreen"):FindFirstChild("TextButton").Visible = true
		end)
	end)
end)

Event.OnServerEvent:Connect(function(player)
	player:LoadCharacter()
end)

LocalScript inside of a button for reset character:

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent",4)

script.Parent.MouseButton1Down:Connect(function()
    Event:FireServer()
end)
1 Like

02:06:24.904 - ServerScriptService.Script:9: attempt to index nil with ‘Visible’ Was the error I got from those scripts.

Did you change locations inside script based on your explorer location and names?

I’m a little big confused. I changed the names to the stuff they needed to like the DeathScreen I changed and a couple other things.

Yet nothing happens when I die.

Send me a picture of your explorer, please.

Just a simple picture of the explorer?

@ArcticGamerTV I send the photo of my explorer.

With open death screen GUI, please.

@ArcticGamerTV here is the photo of it pic

DeathScreen.rbxl (20.5 KB)

Using the same script as my Original Post but with some tweens

Hey! Thanks. Let me give it a test rq.

This should be your script but I tottaly forgot I just could send you a place.

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent",4)

game:GetService('Players').PlayerAdded:Connect(function(player)
	game:GetService("Players").CharacterAutoLoads = true
	player.CharacterAdded:Connect(function(character)
		game:GetService("Players").CharacterAutoLoads = false
		character:WaitForChild("Humanoid").Died:Connect(function()
			player.PlayerGui:FindFirstChild("DeadScreen"):FindFirstChild("Frame").Visible = true
		end)
	end)
end)

Event.OnServerEvent:Connect(function(player)
	player:LoadCharacter()
end)

Please do send me a place that would really help.

DeathScreen_Artic.rbxl (22.0 KB)

Edit: Please download this new version

1 Like

It works very well. Thanks for the help this solved my problem! I might put up a link for the game so you can check it out.

local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent",4)

No reason to have a WaitForChild().

There is no reason to have :FindFirstChild(). Just indexing it would be good, also Humanoid does load in time unless if you have a HUGE game. You are better of using :FindFirstChildWhichIsA.