Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a Pop up gui on death?

Asked by 9 years ago

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

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

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

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? minikitkat 687 — 9y
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. Redbullusa 1580 — 9y
0
Be sure to edit the Size property to "{1, 0},{1, 0}". Redbullusa 1580 — 9y
0
It is not working, nothing happens when I die. minikitkat 687 — 9y
View all comments (5 more)
0
I don't know how to make it work because I am doing everything you say :( minikitkat 687 — 9y
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. Redbullusa 1580 — 9y
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. Redbullusa 1580 — 9y
0
Then, check the output for errors. I've tested this at my place and it works. Go over there to check it out. Redbullusa 1580 — 9y
0
THANK YOU SO MUCH!!!!! I just didn't put it in the starter gui! Thank you thank you thank you!!! minikitkat 687 — 9y
Ad

Answer this question