kill21_2

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

May 9th, 2025 (edited)
20,659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 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. "Money printer",
  25. "Black Rose",
  26. "Green Lucky Block"
  27.  
  28. }
  29.  
  30. -- 1. Находим папку с объектами
  31. local function findItemFolder()
  32. local path = Workspace
  33. for _, folderName in ipairs({"Game", "Entities", SEARCH_FOLDER}) do
  34. path = path:FindFirstChild(folderName)
  35. if not path then return nil end
  36. end
  37. return path
  38. end
  39.  
  40. -- 2. Поиск объектов с нужными атрибутами
  41. local function findTargetItems(folder)
  42. local found = {}
  43. for _, item in ipairs(folder:GetDescendants()) do
  44. if item:IsA("BasePart") or item:IsA("Model") then
  45. local itemName = item:GetAttribute("itemName") or item.Name
  46. if itemName then
  47. for _, target in ipairs(TARGET_ITEMS) do
  48. if string.lower(itemName) == string.lower(target) then
  49. local pos = item:IsA("Model") and (item.PrimaryPart and item.PrimaryPart.Position or item:GetPivot().Position) or item.Position
  50. table.insert(found, {
  51. Object = item,
  52. Position = pos
  53. })
  54. end
  55. end
  56. end
  57. end
  58. end
  59. return found
  60. end
  61.  
  62. -- 3. Телепортация игрока
  63. local function teleportPlayer(player, position)
  64. if not player or not player.Character then return false end
  65.  
  66. local humanoid = player.Character:FindFirstChild("Humanoid")
  67. local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
  68.  
  69. if not humanoid or not rootPart then return false end
  70.  
  71. -- Телепортация + небольшой отступ сверху
  72. rootPart.CFrame = CFrame.new(position + Vector3.new(0, 3, 0))
  73. return true
  74. end
  75.  
  76. -- Основная функция
  77. local function main()
  78. local folder = findItemFolder()
  79. if not folder then
  80. warn("❌ Папка не найдена! Проверьте путь: Workspace.Game.Entities."..SEARCH_FOLDER)
  81. return
  82. end
  83.  
  84. local items = findTargetItems(folder)
  85. if #items == 0 then
  86. warn("⚠️ Объекты не найдены! Проверьте атрибуты itemName или имена объектов.")
  87. return
  88. end
  89.  
  90. local player = Players.LocalPlayer
  91. if not player then return end
  92.  
  93. -- Телепортация ко всем найденным объектам по очереди
  94. for i, item in ipairs(items) do
  95. print(string.format("🚀 Телепортация к объекту %d/%d: %s @ %s",
  96. i, #items, item.Object.Name, tostring(item.Position)))
  97.  
  98. if teleportPlayer(player, item.Position) then
  99. task.wait(2) -- Задержка между телепортациями
  100. end
  101. end
  102.  
  103. print("✅ Телепортация завершена! Найдено объектов: "..#items)
  104. end
  105.  
  106. -- Запуск с задержкой (если объекты подгружаются динамически)
  107. task.wait(2)
  108. main()
Advertisement
Add Comment
Please, Sign In to add comment