Advertisement
MaxproGlitcher

--Test--Severs--Hop--Béta--Déconnection du jeux

Sep 12th, 2023
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2.  
  3. -- Fonction pour tenter de se reconnecter
  4. local function TryReconnect()
  5. print("Tentative de reconnexion...")
  6. game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, game.JobId, Player)
  7. end
  8.  
  9. -- Écouteur d'événement pour la déconnexion
  10. Player.PlayerRemoving:Connect(function()
  11. print("Déconnexion détectée.")
  12. TryReconnect()
  13. end)
  14.  
  15. -- Vérification périodique de l'état de la connexion (peut être inefficace)
  16. while true do
  17. wait(10) -- Vérifier toutes les 10 secondes
  18. if not Player:IsConnected() then
  19. TryReconnect()
  20. end
  21. end
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement