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

Death Gui Pops Up After I Respawn and won't go away, How do I fix this?

so I am trying to make a death gui for my game. And when I die the gui will pop up after I die and then will not go away. Does anyone know a solution for this aka a new script? script I wrote

game.Workspace.Lava4.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		game.Workspace.Sound3.Volume = 0
		game.Workspace.Sound2.Volume = 0
		game.Workspace.Sound1.Volume = 1
		game.StarterGui.DeathGui.Enabled = true
	end
	end)

6 comments

0

there is another script that disablles it, It does not show any error but it does not work

0

Turn off ResetOnSpawn.

0

how do I turn Off ResetOnSpawn

0

nvm got it

0

still does not work

0

set the Enabled to false if reset on spawn didn't work

2 answers

There's a lot of problems in the script You could do this

game.Workspace.Lava4.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        game.Workspace.Sound3.Volume = 0
        game.Workspace.Sound2.Volume = 0
        game.Workspace.Sound1.Volume = 1
	local Player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) -- Finds player by their avatar 
	Player.PlayerGui.DeathGui.Enabled = true
	Player.CharacterAdded:Wait() -- waits until the player's character was readded
	Player.PlayerGui:WaitForChild("DeathGui").Enabled = false
    end
    end)

Hope this helps

1 comment

0

Btw the script would result in an error if the avatar isn't a valid player (like a dummy)

There's many problems with your script but the main one is using StarterGui and not PlayerGui. The changes to StarterGui only apply when you die AFTER they get changed. PlayerGui changes take place instantly.

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