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

When player dies the gui is not removed, tried using a script to do it and its not working, why?

There is this bug with ACS 1.7.5, I'm not sure why its not patched, the gui does not remove after you die, it just stays there are overlaps which is very annoying as the whole screen is filled with blood / intense gui. This is the script I tried using:

game.Players.PlayerAdded:connect(function(plr)

local player = game.Players.LocalPlayer
local character = player.Character

character:WaitForChild("Humanoid").Died:Connect(function()
	plr:WaitForChild("PlayerGui"):Destroy()
		end)
	end)

1 answer

game.Players.PlayerAdded:connect(function(plr)

local player = game.Players.LocalPlayer
local character = player.Character

character:WaitForChild("Humanoid").Died:Connect(function()
    for i,v in pairs(plr:WaitForChild("PlayerGui"):GetChildren()) do
	v:Destroy()
	end
	end)
end)

If it doesn't work, try this

game.Players.PlayerAdded:connect(function(plr)

local player = game.Players.LocalPlayer
local character = player.Character

character:WaitForChild("Humanoid").Died:Connect(function()
    for i,v in pairs(plr:FindFirstChild("PlayerGui"):GetChildren()) do
	v:Destroy()
	end
	end)
end)

1 comment

0

Where do I put it? When I tried it it didn't work.

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