Advertisement
kill21_2

собератель полезного

May 9th, 2025 (edited)
1,473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. local Workspace = game:GetService("Workspace")
  2. local Players = game:GetService("Players")
  3.  
  4. -- Настройки поиска
  5. local SEARCH_FOLDER = "ItemPickup" -- Папка с объектами
  6. local TARGET_ITEMS = { -- Искомые атрибуты/значения
  7. "Small present",
  8. "Mustang key",
  9. "NextBot Grenade",
  10. "Heavy Vest",
  11. "Rollie",
  12. "Gold AK-47",
  13. "P90",
  14. "Airstrike Marker",
  15. "helicopter key",
  16. "Gold Lucky Block",
  17. "Blue Lucky Block",
  18. "Police Armory Keycard",
  19. "Red Lucky Block",
  20. "Orange Lucky Block",
  21. "Military Armory Keycard",
  22. "Airdrop Marker",
  23. "Ammo Box",
  24. "Green Lucky Block"
  25.  
  26. }
  27.  
  28. -- 1. Находим папку с объектами
  29. local function findItemFolder()
  30. local path = Workspace
  31. for _, folderName in ipairs({"Game", "Entities", SEARCH_FOLDER}) do
  32. path = path:FindFirstChild(folderName)
  33. if not path then return nil end
  34. end
  35. return path
  36. end
  37.  
  38. -- 2. Поиск объектов с нужными атрибутами
  39. local function findTargetItems(folder)
  40. local found = {}
  41. for _, item in ipairs(folder:GetDescendants()) do
  42. if item:IsA("BasePart") or item:IsA("Model") then
  43. local itemName = item:GetAttribute("itemName") or item.Name
  44. if itemName then
  45. for _, target in ipairs(TARGET_ITEMS) do
  46. if string.lower(itemName) == string.lower(target) then
  47. local pos = item:IsA("Model") and (item.PrimaryPart and item.PrimaryPart.Position or item:GetPivot().Position) or item.Position
  48. table.insert(found, {
  49. Object = item,
  50. Position = pos
  51. })
  52. end
  53. end
  54. end
  55. end
  56. end
  57. return found
  58. end
  59.  
  60. -- 3. Телепортация игрока
  61. local function teleportPlayer(player, position)
  62. if not player or not player.Character then return false end
  63.  
  64. local humanoid = player.Character:FindFirstChild("Humanoid")
  65. local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
  66.  
  67. if not humanoid or not rootPart then return false end
  68.  
  69. -- Телепортация + небольшой отступ сверху
  70. rootPart.CFrame = CFrame.new(position + Vector3.new(0, 3, 0))
  71. return true
  72. end
  73.  
  74. -- Основная функция
  75. local function main()
  76. local folder = findItemFolder()
  77. if not folder then
  78. warn("❌ Папка не найдена! Проверьте путь: Workspace.Game.Entities."..SEARCH_FOLDER)
  79. return
  80. end
  81.  
  82. local items = findTargetItems(folder)
  83. if #items == 0 then
  84. warn("⚠️ Объекты не найдены! Проверьте атрибуты itemName или имена объектов.")
  85. return
  86. end
  87.  
  88. local player = Players.LocalPlayer
  89. if not player then return end
  90.  
  91. -- Телепортация ко всем найденным объектам по очереди
  92. for i, item in ipairs(items) do
  93. print(string.format("🚀 Телепортация к объекту %d/%d: %s @ %s",
  94. i, #items, item.Object.Name, tostring(item.Position)))
  95.  
  96. if teleportPlayer(player, item.Position) then
  97. task.wait(2) -- Задержка между телепортациями
  98. end
  99. end
  100.  
  101. print("✅ Телепортация завершена! Найдено объектов: "..#items)
  102. end
  103.  
  104. -- Запуск с задержкой (если объекты подгружаются динамически)
  105. task.wait(2)
  106. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement