Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a Pop up gui on death?

Hello! I am trying to figure out how to make an image pop up on a players screen when they have died. Kind of like in GTA when you die it says "WASTED". I need the script to be inserted into the player for it to work I think. Thank you!

~Minikitkat

1 answer

✓ Accepted answer

More than likely, the script would have to be inserted into your character. To do this, make your GUI and set the Visible property to false. Then, you will need a server script in ServerScriptService (preferably) with the following code:

function onPlayerEntered(player)						-- "Player" as argument
	repeat wait() until player.Character ~= nil			-- Makes sure the character finished rendering
	local Wasted = script.LocalScript:clone()			-- Sets a variable to your script
	Wasted.Parent = player.Character					-- Places the script in the character
	Wasted.Disabled = false							-- Enables the script
	player.CharacterAdded:connect(function (char)	-- Every time the character spawns, this will happen to it; "char' as argument
		repeat wait() until char ~= nil					-- Makes sure the character finished rendering; not really necessary, but better safe than sorry?
		local Wasted = script.LocalScript:clone()		-- Sets a variable to your script
		Wasted.Parent = char			-- Places the script in the character
		Wasted.Disabled = false						-- Enables the script
	end)
end

game.Players.PlayerAdded:connect(onPlayerEntered) -- When player enters, the assigned function will be triggered

Then insert a LocalScript in the aforementioned script, disable it, and add something like this:

s = script.Parent

s.Humanoid.Died:connect(function () -- If your humanoid died, this is triggered
	game.Players.LocalPlayer.PlayerGui.WastedGUI.Frame.Visible = true -- Assuming that your GUI's name is "WastedGUI" & its descendant is a Frame
end)

If you want to add a little twist, you can add a Sound object in your Gui, then add the code to play the audio in your LocalScript. :P

9 comments

0

Okay. I got as far as putting in the GUI renaming it WastedGUI and then adding in a frame. But how can I make it an image? Can you help?

0

Insert an ImageLabel inside the Frame, set the BackGround Transparency to 1 (because it's ugly if it's visible), and insert your image in the "Image" property.

0

Be sure to edit the Size property to "{1, 0},{1, 0}".

0

It is not working, nothing happens when I die.

0

I don't know how to make it work because I am doing everything you say :(

0

All right, check if the first code is in a Script. Check if the second code is in a LocalScript. Check if the LocalScript is inside of the Script.

0

Now, check your GUI. Check if your GUI is a ScreenGUI named "WastedGUI." Check if a Frame is inside the WastedGUI. Check if the WastedGUI is in "StarterGUI," & is NOT visible.

0

Then, check the output for errors. I've tested this at my place and it works. Go over there to check it out.

0

THANK YOU SO MUCH!!!!! I just didn't put it in the starter gui! Thank you thank you thank you!!!

This discussion is preserved as it was. New answers, comments, and votes are closed.