1 | game.Players.LocalPlayer.Character:WaitForChild( 'Humanoid' ).Died:connect( function () |
2 | script.Parent.Parent.Frame.Visible = true |
3 | end ) |
When you join a game it will take a small amout of time until the character is created. This delay is not included in studio. We commonly use the following code to wait for the character:-
1 | local localPlr = game:GetService( 'Players' ).LocalPlayer |
2 | local char = localPlr.Character or localPlr.CharacterAdded:Wait() -- if the character is nil ie not loaded wait intil the character is added and return the character model to the char variable |
Putting it all together
1 | local localPlr = game:GetService( 'Players' ).LocalPlayer |
2 | local char = localPlr.Character or localPlr.CharacterAdded:Wait() |
3 |
4 | char:WaitForChild( 'Humanoid' ).Died:Connect( function () |
5 | script.Parent.Parent.Frame.Visible = true |
6 | end ) |
Note this should be a local script in the gui.
I hope this helps.
Use the transparency property instead of the visible property.
im sure this will work if not then ill fix it
1 | script.Parent.Parent.Frame:WaitForChild() |
2 | game.Players.LocalPlayer.Character:WaitForChild( 'Humanoid' ).Died:connect( function () |
3 | script.Parent.Parent.Frame.Visible = true |
4 | end ) |