Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- -- Fonction pour relancer le jeu
- local function reconnect()
- local player = Players.LocalPlayer
- local success, errorMessage = pcall(function()
- -- Tentative de reconnexion
- player:Kick("Tentative de reconnexion au jeu...")
- wait(5) -- Attendre 5 secondes avant de relancer le jeu
- game:GetService("TeleportService"):Teleport(game.PlaceId, player)
- end)
- if not success then
- warn("Erreur lors de la tentative de reconnexion: " .. errorMessage)
- end
- end
- -- Événement déclenché lors de la déconnexion du joueur
- Players.LocalPlayer.OnTeleport:Connect(function(teleportState)
- if teleportState == Enum.TeleportState.Failed then
- reconnect()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment