Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local player = Players.LocalPlayer
- local gui = Instance.new("ScreenGui")
- gui.Name = "TeleportGUI"
- gui.ResetOnSpawn = false
- gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- gui.Parent = player:WaitForChild("PlayerGui")
- -- Основной фрейм
- local mainFrame = Instance.new("Frame")
- mainFrame.Name = "MainFrame"
- mainFrame.Size = UDim2.new(0, 350, 0, 250)
- mainFrame.Position = UDim2.new(0.5, -175, 0.5, -125)
- mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- mainFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 18)
- mainFrame.BorderColor3 = Color3.fromRGB(75, 0, 130)
- mainFrame.BorderSizePixel = 2
- mainFrame.Parent = gui
- -- Заголовок
- local title = Instance.new("TextLabel")
- title.Name = "Title"
- title.Size = UDim2.new(1, 0, 0, 40)
- title.Position = UDim2.new(0, 0, 0, 0)
- title.BackgroundColor3 = Color3.fromRGB(30, 0, 50)
- title.BorderSizePixel = 0
- title.Text = "OBJECT TELEPORT"
- title.TextColor3 = Color3.fromRGB(200, 180, 255)
- title.Font = Enum.Font.GothamBold
- title.TextSize = 18
- title.Parent = mainFrame
- -- Поле для ввода
- local inputBox = Instance.new("TextBox")
- inputBox.Name = "InputBox"
- inputBox.Size = UDim2.new(0.9, 0, 0, 35)
- inputBox.Position = UDim2.new(0.05, 0, 0.2, 0)
- inputBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- inputBox.BorderColor3 = Color3.fromRGB(100, 0, 180)
- inputBox.TextColor3 = Color3.fromRGB(220, 220, 220)
- inputBox.PlaceholderText = "Введите имя объекта..."
- inputBox.Font = Enum.Font.Gotham
- inputBox.TextSize = 14
- inputBox.Parent = mainFrame
- -- Кнопка телепортации
- local teleportButton = Instance.new("TextButton")
- teleportButton.Name = "TeleportButton"
- teleportButton.Size = UDim2.new(0.9, 0, 0, 35)
- teleportButton.Position = UDim2.new(0.05, 0, 0.4, 0)
- teleportButton.BackgroundColor3 = Color3.fromRGB(80, 0, 120)
- teleportButton.BorderSizePixel = 0
- teleportButton.Text = "ТЕЛЕПОРТИРОВАТЬСЯ"
- teleportButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- teleportButton.Font = Enum.Font.GothamBold
- teleportButton.TextSize = 14
- teleportButton.Parent = mainFrame
- -- Эффект при наведении на кнопку
- teleportButton.MouseEnter:Connect(function()
- teleportButton.BackgroundColor3 = Color3.fromRGB(120, 0, 180)
- end)
- teleportButton.MouseLeave:Connect(function()
- teleportButton.BackgroundColor3 = Color3.fromRGB(80, 0, 120)
- end)
- -- Кнопка копирования скрипта
- local copyScriptButton = Instance.new("TextButton")
- copyScriptButton.Name = "CopyScriptButton"
- copyScriptButton.Size = UDim2.new(0.9, 0, 0, 35)
- copyScriptButton.Position = UDim2.new(0.05, 0, 0.55, 0)
- copyScriptButton.BackgroundColor3 = Color3.fromRGB(50, 0, 80)
- copyScriptButton.BorderSizePixel = 0
- copyScriptButton.Text = "КОПИРОВАТЬ СКРИПТ"
- copyScriptButton.TextColor3 = Color3.fromRGB(200, 180, 255)
- copyScriptButton.Font = Enum.Font.GothamBold
- copyScriptButton.TextSize = 14
- copyScriptButton.Parent = mainFrame
- -- Эффект при наведении на кнопку
- copyScriptButton.MouseEnter:Connect(function()
- copyScriptButton.BackgroundColor3 = Color3.fromRGB(80, 0, 130)
- end)
- copyScriptButton.MouseLeave:Connect(function()
- copyScriptButton.BackgroundColor3 = Color3.fromRGB(50, 0, 80)
- end)
- -- Кнопка закрытия
- local closeButton = Instance.new("TextButton")
- closeButton.Name = "CloseButton"
- closeButton.Size = UDim2.new(0, 30, 0, 30)
- closeButton.Position = UDim2.new(1, -35, 0, 5)
- closeButton.BackgroundColor3 = Color3.fromRGB(200, 0, 0)
- closeButton.BorderSizePixel = 0
- closeButton.Text = "X"
- closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- closeButton.Font = Enum.Font.GothamBold
- closeButton.TextSize = 16
- closeButton.Parent = mainFrame
- -- Эффект при наведении на кнопку
- closeButton.MouseEnter:Connect(function()
- closeButton.BackgroundColor3 = Color3.fromRGB(255, 50, 50)
- end)
- closeButton.MouseLeave:Connect(function()
- closeButton.BackgroundColor3 = Color3.fromRGB(200, 0, 0)
- end)
- -- Функция телепортации к объекту
- local function teleportToObject(objectName)
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- for _, obj in ipairs(workspace:GetDescendants()) do
- if obj.Name == objectName then
- -- Если объект имеет позицию (BasePart)
- if obj:IsA("BasePart") then
- humanoidRootPart.CFrame = obj.CFrame + Vector3.new(0, 3, 0)
- return true
- -- Если это модель, используем PrimaryPart или первый найденный BasePart
- elseif obj:IsA("Model") then
- local targetPart = obj.PrimaryPart or obj:FindFirstChildWhichIsA("BasePart")
- if targetPart then
- humanoidRootPart.CFrame = targetPart.CFrame + Vector3.new(0, 3, 0)
- return true
- end
- end
- end
- end
- return false
- end
- -- Функционал кнопок
- teleportButton.MouseButton1Click:Connect(function()
- local objectName = inputBox.Text
- if objectName == "" then
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Ошибка",
- Text = "Введите имя объекта!",
- Duration = 3
- })
- return
- end
- local success = teleportToObject(objectName)
- if success then
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Успешно",
- Text = "Телепортирован к '"..objectName.."'",
- Duration = 3
- })
- else
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Ошибка",
- Text = "Объект '"..objectName.."' не найден!",
- Duration = 3
- })
- end
- end)
- copyScriptButton.MouseButton1Click:Connect(function()
- local objectName = inputBox.Text
- if objectName == "" then
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Ошибка",
- Text = "Сначала введите имя объекта!",
- Duration = 3
- })
- return
- end
- local scriptToCopy = [[
- -- Скрипт для телепортации к объекту: ]]..objectName..[[
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local function teleportToObject(objName)
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- for _, obj in ipairs(workspace:GetDescendants()) do
- if obj.Name == "]]..objectName..[[" then
- -- Для BasePart
- if obj:IsA("BasePart") then
- humanoidRootPart.CFrame = obj.CFrame + Vector3.new(0, 3, 0)
- return true
- -- Для Model
- elseif obj:IsA("Model") then
- local targetPart = obj.PrimaryPart or obj:FindFirstChildWhichIsA("BasePart")
- if targetPart then
- humanoidRootPart.CFrame = targetPart.CFrame + Vector3.new(0, 3, 0)
- return true
- end
- end
- end
- end
- return false
- end
- -- Вызов функции телепортации
- local success = teleportToObject("]]..objectName..[[")
- if success then
- print("Успешно телепортирован к ']]..objectName..[['")
- else
- warn("Объект ']]..objectName..[[' не найден!")
- end
- ]]
- setclipboard(scriptToCopy)
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = "Скрипт скопирован",
- Text = "Скрипт телепортации для '"..objectName.."' в буфере",
- Duration = 3
- })
- end)
- closeButton.MouseButton1Click:Connect(function()
- gui:Destroy()
- end)
- -- Функционал перемещения окна
- local dragging
- local dragInput
- local dragStart
- local startPos
- local function update(input)
- local delta = input.Position - dragStart
- mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- title.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = mainFrame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- title.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement