Advertisement
kill21_2

farm battle

May 21st, 2025 (edited)
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. -- Сохраняем ссылку на основной скрипт в глобальной переменной
  2. if not _G.TeleportScript then
  3. _G.TeleportScript = coroutine.create(function()
  4. -- Настройки
  5. local initialPosition = Vector3.new(-1010.22, 328.23, 4.06)
  6. local teleportDelay = 2
  7. local heightOffset = 3
  8. local respawnDelay = 1
  9. local maxRespawnWaitTime = 10
  10.  
  11. -- Функция для отладки
  12. local function debugPrint(...)
  13. print("[Teleport ON]", os.date("%X"), ...)
  14. end
  15.  
  16. -- Надежная функция ожидания возрождения
  17. local function waitForRespawn()
  18. debugPrint("Инициируем смерть персонажа")
  19.  
  20. local char = game.Players.LocalPlayer.Character
  21. if char then
  22. local humanoid = char:FindFirstChildOfClass("Humanoid")
  23. if humanoid then
  24. humanoid.Health = 0
  25. else
  26. char:BreakJoints()
  27. end
  28. end
  29.  
  30. debugPrint("Ожидаем возрождения...")
  31. local startTime = tick()
  32. local newChar
  33.  
  34. repeat
  35. wait(0.5)
  36. newChar = game.Players.LocalPlayer.Character
  37. if tick() - startTime > maxRespawnWaitTime then
  38. debugPrint("Таймаут ожидания возрождения!")
  39. return false
  40. end
  41. until newChar and newChar.PrimaryPart and newChar:FindFirstChildOfClass("Humanoid") and newChar:FindFirstChildOfClass("Humanoid").Health > 0
  42.  
  43. debugPrint("Персонаж успешно возродился")
  44. wait(respawnDelay)
  45. return true
  46. end
  47.  
  48. -- Основной рабочий цикл
  49. while _G.TeleportScriptRunning do
  50. debugPrint("\n=== НАЧАЛО НОВОГО ЦИКЛА ===")
  51.  
  52. -- Ожидаем готовность персонажа
  53. while _G.TeleportScriptRunning and (not game.Players.LocalPlayer.Character or not game.Players.LocalPlayer.Character.PrimaryPart) do
  54. wait(0.5)
  55. end
  56.  
  57. if not _G.TeleportScriptRunning then break end
  58.  
  59. -- Телепорт к начальной позиции
  60. debugPrint("Телепорт к начальной позиции")
  61. game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(CFrame.new(initialPosition))
  62. wait(teleportDelay)
  63.  
  64. -- Телепорт к объектам
  65. local slapples = workspace:FindFirstChild("Arena") and
  66. workspace.Arena:FindFirstChild("island5") and
  67. workspace.Arena.island5:FindFirstChild("Slapples")
  68.  
  69. if slapples then
  70. for _, obj in ipairs(slapples:GetChildren()) do
  71. if not _G.TeleportScriptRunning then break end
  72.  
  73. local targetPart = obj:IsA("BasePart") and obj or
  74. (obj:IsA("Model") and (obj.PrimaryPart or obj:FindFirstChildWhichIsA("BasePart")))
  75.  
  76. if targetPart then
  77. debugPrint("Телепорт к "..obj.Name)
  78. local targetPos = targetPart.Position + Vector3.new(0, heightOffset, 0)
  79. game.Players.LocalPlayer.Character:SetPrimaryPartCFrame(CFrame.new(targetPos))
  80. wait(teleportDelay)
  81. end
  82. end
  83. else
  84. debugPrint("Папка Slapples не найдена!")
  85. end
  86.  
  87. if _G.TeleportScriptRunning and not waitForRespawn() then
  88. debugPrint("Проблема с возрождением, пробуем снова...")
  89. wait(3)
  90. end
  91. end
  92. debugPrint("Телепортация остановлена")
  93. end)
  94. end
  95.  
  96. -- Запускаем скрипт
  97. _G.TeleportScriptRunning = true
  98. coroutine.resume(_G.TeleportScript)
  99. print("Телепортация АКТИВИРОВАНА (Ctrl+F8 для выключения)")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement