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

I need a script to make when the player dies/rests the ScreenGui Disappear ?

i have turned off the rest on respawn command but its still not deleting the Gui when the player dies or rests. Plz help me ?

3 comments

0

You could try making a script that makes the GUIs.Enabled = false when an certain event is fired.

0

Hey you have to turn ResetOnSpawn to true and not to false

0

And you don't need a script for that

2 answers

✓ Accepted answer

Hello, Ash_Gold!

You could use the Humanoid.Died function to tell when a player has died. When they do die you can go and disable the script.

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character.Humanoid or Character:WaitForChild("Humanoid")

local ScreenGuiName = "ScreenGui"

Humanoid.Died:Connect(function()
	PlayerGui:WaitForChild(ScreenGuiName).Enabled = false
end)

3 comments

0

@xWhiteHat what script is it a normal script or a localscript and where does the scipt go in e.g starterpack ,screengui

0

@Ash_Gold Sorry for the late reply. I made a LocalScript inside of StarterPlayerScripts and put that inside of it.

0

Thank yea all for helping me with this command for my game if you would like i would send you a link to my new game when it is done

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