Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- -- Настройки
- local TELEPORT_DELAY = 3 -- Задержка между телепортациями
- local ABOVE_BOX_HEIGHT = 3 -- Высота над ящиком
- -- Состояние
- local isTeleporting = false
- local currentPlayer = nil
- local foundBoxes = {}
- local stopTeleport = false
- local dragging = false
- local dragStartPos, frameStartPos
- -- Создаем красивый GUI
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "ComponentBoxTeleporter"
- screenGui.ResetOnSpawn = false
- local mainFrame = Instance.new("Frame")
- mainFrame.Size = UDim2.new(0, 320, 0, 240)
- mainFrame.Position = UDim2.new(0.5, -160, 0.5, -120)
- mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
- mainFrame.BorderSizePixel = 0
- mainFrame.ClipsDescendants = true
- -- Скругленные углы
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 8)
- corner.Parent = mainFrame
- -- Тень
- local shadow = Instance.new("ImageLabel")
- shadow.Name = "Shadow"
- shadow.Image = "rbxassetid://1316045217"
- shadow.ImageColor3 = Color3.new(0, 0, 0)
- shadow.ImageTransparency = 0.8
- shadow.ScaleType = Enum.ScaleType.Slice
- shadow.SliceCenter = Rect.new(10, 10, 118, 118)
- shadow.Size = UDim2.new(1, 20, 1, 20)
- shadow.Position = UDim2.new(0, -10, 0, -10)
- shadow.BackgroundTransparency = 1
- shadow.Parent = mainFrame
- -- Заголовок с кнопкой закрытия
- local titleBar = Instance.new("Frame")
- titleBar.Size = UDim2.new(1, 0, 0, 32)
- titleBar.Position = UDim2.new(0, 0, 0, 0)
- titleBar.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
- titleBar.BorderSizePixel = 0
- titleBar.Name = "TitleBar"
- local titleCorner = Instance.new("UICorner")
- titleCorner.CornerRadius = UDim.new(0, 8)
- titleCorner.Parent = titleBar
- local title = Instance.new("TextLabel")
- title.Text = "COMPONENT BOX TELEPORTER"
- title.Size = UDim2.new(1, -40, 1, 0)
- title.Position = UDim2.new(0, 10, 0, 0)
- title.BackgroundTransparency = 1
- title.TextColor3 = Color3.fromRGB(220, 220, 220)
- title.Font = Enum.Font.GothamBold
- title.TextSize = 14
- title.TextXAlignment = Enum.TextXAlignment.Left
- title.Parent = titleBar
- local closeButton = Instance.new("ImageButton")
- closeButton.Size = UDim2.new(0, 24, 0, 24)
- closeButton.Position = UDim2.new(1, -30, 0.5, -12)
- closeButton.BackgroundTransparency = 1
- closeButton.Image = "rbxassetid://3926305904"
- closeButton.ImageRectOffset = Vector2.new(284, 4)
- closeButton.ImageRectSize = Vector2.new(24, 24)
- closeButton.ImageColor3 = Color3.fromRGB(200, 200, 200)
- closeButton.Parent = titleBar
- titleBar.Parent = mainFrame
- -- Основное содержимое
- local contentFrame = Instance.new("Frame")
- contentFrame.Size = UDim2.new(1, -20, 1, -72)
- contentFrame.Position = UDim2.new(0, 10, 0, 42)
- contentFrame.BackgroundTransparency = 1
- contentFrame.Parent = mainFrame
- -- Информационные метки
- local function createInfoLabel(text, yPos)
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(1, 0, 0, 20)
- frame.Position = UDim2.new(0, 0, 0, yPos)
- frame.BackgroundTransparency = 1
- local icon = Instance.new("ImageLabel")
- icon.Size = UDim2.new(0, 16, 0, 16)
- icon.Position = UDim2.new(0, 0, 0.5, -8)
- icon.BackgroundTransparency = 1
- icon.Image = "rbxassetid://3926305904"
- icon.ImageColor3 = Color3.fromRGB(120, 170, 255)
- icon.Parent = frame
- local label = Instance.new("TextLabel")
- label.Text = text
- label.Size = UDim2.new(1, -25, 1, 0)
- label.Position = UDim2.new(0, 25, 0, 0)
- label.TextColor3 = Color3.fromRGB(200, 200, 200)
- label.Font = Enum.Font.Gotham
- label.TextSize = 14
- label.TextXAlignment = Enum.TextXAlignment.Left
- label.BackgroundTransparency = 1
- label.Parent = frame
- return label
- end
- local infoLabel = createInfoLabel("Найдено ящиков: 0", 0)
- infoLabel.Name = "InfoLabel"
- infoLabel.Parent = contentFrame
- local progressLabel = createInfoLabel("Прогресс: -/-", 30)
- progressLabel.Name = "ProgressLabel"
- progressLabel.Parent = contentFrame
- local currentPosLabel = createInfoLabel("Текущая позиция: -", 60)
- currentPosLabel.Name = "CurrentPosLabel"
- currentPosLabel.Size = UDim2.new(1, -25, 0, 60)
- currentPosLabel.TextWrapped = true
- currentPosLabel.Parent = contentFrame
- -- Кнопка старта/остановки
- local toggleButton = Instance.new("TextButton")
- toggleButton.Text = "СТАРТ"
- toggleButton.Size = UDim2.new(0, 140, 0, 36)
- toggleButton.Position = UDim2.new(0.5, -70, 1, -50)
- toggleButton.AnchorPoint = Vector2.new(0.5, 1)
- toggleButton.BackgroundColor3 = Color3.fromRGB(70, 130, 200)
- toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- toggleButton.Font = Enum.Font.GothamBold
- toggleButton.TextSize = 14
- toggleButton.AutoButtonColor = false
- -- Стиль кнопки
- local buttonCorner = Instance.new("UICorner")
- buttonCorner.CornerRadius = UDim.new(0, 6)
- buttonCorner.Parent = toggleButton
- local buttonStroke = Instance.new("UIStroke")
- buttonStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
- buttonStroke.Color = Color3.fromRGB(100, 160, 220)
- buttonStroke.Thickness = 2
- buttonStroke.Parent = toggleButton
- -- Эффект наведения
- toggleButton.MouseEnter:Connect(function()
- game:GetService("TweenService"):Create(toggleButton, TweenInfo.new(0.1), {BackgroundColor3 = Color3.fromRGB(90, 150, 220)}):Play()
- end)
- toggleButton.MouseLeave:Connect(function()
- game:GetService("TweenService"):Create(toggleButton, TweenInfo.new(0.1), {BackgroundColor3 = isTeleporting and Color3.fromRGB(200, 80, 80) or Color3.fromRGB(70, 130, 200)}):Play()
- end)
- toggleButton.Parent = mainFrame
- mainFrame.Parent = screenGui
- -- Функции для перемещения GUI
- local function startDrag(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStartPos = input.Position
- frameStartPos = mainFrame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end
- local function updateDrag(input)
- if dragging then
- local delta = input.Position - dragStartPos
- mainFrame.Position = UDim2.new(frameStartPos.X.Scale, frameStartPos.X.Offset + delta.X, frameStartPos.Y.Scale, frameStartPos.Y.Offset + delta.Y)
- end
- end
- titleBar.InputBegan:Connect(startDrag)
- titleBar.InputChanged:Connect(updateDrag)
- -- Закрытие GUI
- closeButton.MouseButton1Click:Connect(function()
- screenGui:Destroy()
- end)
- closeButton.MouseEnter:Connect(function()
- closeButton.ImageColor3 = Color3.fromRGB(255, 100, 100)
- end)
- closeButton.MouseLeave:Connect(function()
- closeButton.ImageColor3 = Color3.fromRGB(200, 200, 200)
- end)
- -- Остальные функции (без изменений)
- local function findComponentBoxes()
- local itemPickups = workspace.Game.Entities.ItemPickup:GetChildren()
- local foundItems = {}
- for _, item in ipairs(itemPickups) do
- if item:GetAttribute("itemName") == "Component Box" then
- local position = item:GetPivot().Position
- table.insert(foundItems, {
- item = item,
- position = position + Vector3.new(0, ABOVE_BOX_HEIGHT, 0)
- })
- end
- end
- return foundItems
- end
- local function smoothTeleport(character, position)
- if not character or not character:FindFirstChild("HumanoidRootPart") then
- return false
- end
- local humanoidRootPart = character.HumanoidRootPart
- local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local tween = TweenService:Create(humanoidRootPart, tweenInfo, {CFrame = CFrame.new(position)})
- tween:Play()
- return true
- end
- local function teleportPlayerToBoxes(player)
- if not player.Character then
- player.CharacterAdded:Wait()
- end
- for i, boxData in ipairs(foundBoxes) do
- if stopTeleport then break end
- progressLabel.Text = string.format("Прогресс: %d/%d", i, #foundBoxes)
- currentPosLabel.Text = string.format("Текущая позиция: %s\n(%.1f, %.1f, %.1f)",
- boxData.item.Name, boxData.position.X, boxData.position.Y, boxData.position.Z)
- if smoothTeleport(player.Character, boxData.position) then
- local elapsed = 0
- while elapsed < TELEPORT_DELAY and not stopTeleport do
- elapsed += wait(0.1)
- end
- end
- end
- isTeleporting = false
- stopTeleport = false
- toggleButton.Text = "СТАРТ"
- toggleButton.BackgroundColor3 = Color3.fromRGB(70, 130, 200)
- if not stopTeleport then
- currentPosLabel.Text = "Телепортация завершена!"
- else
- currentPosLabel.Text = "Телепортация остановлена"
- end
- end
- toggleButton.MouseButton1Click:Connect(function()
- if isTeleporting then
- stopTeleport = true
- toggleButton.BackgroundColor3 = Color3.fromRGB(70, 130, 200)
- return
- end
- isTeleporting = true
- stopTeleport = false
- toggleButton.Text = "СТОП"
- toggleButton.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
- foundBoxes = findComponentBoxes()
- infoLabel.Text = string.format("Найдено ящиков: %d", #foundBoxes)
- if #foundBoxes == 0 then
- currentPosLabel.Text = "Ящики не найдены!"
- isTeleporting = false
- toggleButton.Text = "СТАРТ"
- toggleButton.BackgroundColor3 = Color3.fromRGB(70, 130, 200)
- return
- end
- local player = Players.LocalPlayer
- currentPlayer = player
- coroutine.wrap(function()
- teleportPlayerToBoxes(player)
- end)()
- end)
- -- Инициализация
- if RunService:IsClient() then
- screenGui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
- else
- Players.PlayerAdded:Connect(function(player)
- local playerGui = player:WaitForChild("PlayerGui")
- local guiClone = screenGui:Clone()
- guiClone.Parent = playerGui
- end)
- for _, player in ipairs(Players:GetPlayers()) do
- local playerGui = player:WaitForChild("PlayerGui")
- local guiClone = screenGui:Clone()
- guiClone.Parent = playerGui
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement