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

How would you make a frame visible only for a certain amount of time?

Asked by 4 years ago

Ex: when you die a frame gui stays on your screen for 5 seconds

Thats an example dont do. do it only if you want to .-.

2 answers

Log in to vote
0
Answered by
Sparks 534 Moderation Voter
4 years ago
Edited 4 years ago

You will want to use the .Enabled property of frames.

Put a frame in a ScreenGui and put a localscript inside the frame. Then, you can use the Humanoid.Died event to check when you died.

local frame = script.Parent
game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
    frame.Enabled = true
    wait(5)
    frame.Enabled = false
end)

However, if the player respawns within 5 seconds, the character's startguis will be destroyed and new ones will be cloned. There are ways to circumvent this such as disabling Player.CharacterAutoLoads and showing the screen for 5 seconds, and then manually respawning them yourself.

Ad
Log in to vote
0
Answered by 4 years ago

If you want to make a death screen, then here's how you do it.

Make your death gui

Set Enabled to false on the gui

Set ResetOnSpawn to true on the gui

Then add the following script to the gui:


repeat wait() until game.Players.LocalPlayer.Character char = game.Players.LocalPlayer.Character local humanoid = char:WaitForChild("Humanoid") humanoid.Died:Connect(function() script.Parent.Enabled = true end)

Make sure the script is directly in the gui

Hope this works!

Answer this question