When Player dies and respawns the gui is suppose to go visible
01 | local Players = game:GetService( "Players" ) |
02 | game.Players.PlayerAdded:Connect( function (Player) |
03 | Player.CharacterAdded:Connect( function (Char) |
04 | Char.Humanoid.Died:Connect( function () |
05 | if Char.Humanoid.Health = = 100 then |
06 | Player.PlayerGui.MainUI.Enabled = true |
07 | Player.PlayerGui.MoneyGui.Enabled = true |
08 | end |
09 | end ) |
10 | end ) |
11 | end ) |
I found a few errors on the script also you need to put a wait in there when the humanoid has 100 health because when the humanoid is still respawning the Gui goes visible. Here is the fixed script put it in serverscriptservice.
01 | local Players = game:GetService( "Players" ) |
02 |
03 | game.Players.PlayerAdded:Connect( function (Player) |
04 |
05 | Player.CharacterAdded:Connect( function (Char) |
06 |
07 | Char.Humanoid.Died:Connect( function () |
08 |
09 | if Char.Humanoid.MaxHealth = = 100 then -- majour error you forgot to do MaxHealth |
10 |
11 | wait( 4 ) -- if you want to change this make the number greater than 4 because it takes about 3. something seconds to fully respawn |
12 |
13 | Player.PlayerGui.MainUI.Enabled = true |
14 |
15 | Player.PlayerGui.MoneyGui.Enabled = true |
Hope this helps!!