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

No errors When Player Humanoid dead and respawns not working??

When Player dies and respawns the gui is suppose to go visible

local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Char)
		Char.Humanoid.Died:Connect(function()
			if Char.Humanoid.Health == 100 then
			Player.PlayerGui.MainUI.Enabled = true
				Player.PlayerGui.MoneyGui.Enabled = true
				end
		end)
	end)
end)

1 answer

✓ Accepted answer

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.

local Players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(Player)

	Player.CharacterAdded:Connect(function(Char)

		Char.Humanoid.Died:Connect(function()

			if Char.Humanoid.MaxHealth == 100 then-- majour error you forgot to do MaxHealth

				wait(4)-- if you want to change this make the number greater than 4 because it takes about 3. something seconds to fully respawn 

				Player.PlayerGui.MainUI.Enabled = true

				Player.PlayerGui.MoneyGui.Enabled = true

				end

		end)

	end)

end)

Hope this helps!!

1 comment

0

Thx it worked

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