Advertisement
kill21_2

Управления полетом

Apr 26th, 2025
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.06 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local gui = Instance.new("ScreenGui")
  3. gui.Name = "FlightGUI"
  4. gui.ResetOnSpawn = false
  5. gui.Parent = player.PlayerGui
  6.  
  7. -- Основной фрейм с возможностью перемещения
  8. local frame = Instance.new("Frame")
  9. frame.Size = UDim2.new(0, 320, 0, 280)
  10. frame.Position = UDim2.new(0.5, -160, 0.5, -140)
  11. frame.AnchorPoint = Vector2.new(0.5, 0.5)
  12. frame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
  13. frame.BorderSizePixel = 0
  14. frame.ClipsDescendants = true
  15. frame.Parent = gui
  16.  
  17. -- Скругление углов
  18. local corner = Instance.new("UICorner")
  19. corner.CornerRadius = UDim.new(0, 8)
  20. corner.Parent = frame
  21.  
  22. -- Тень
  23. local shadow = Instance.new("ImageLabel")
  24. shadow.Name = "Shadow"
  25. shadow.Image = "rbxassetid://1316045217"
  26. shadow.ImageColor3 = Color3.fromRGB(0, 0, 0)
  27. shadow.ImageTransparency = 0.8
  28. shadow.ScaleType = Enum.ScaleType.Slice
  29. shadow.SliceCenter = Rect.new(10, 10, 118, 118)
  30. shadow.Size = UDim2.new(1, 20, 1, 20)
  31. shadow.Position = UDim2.new(0, -10, 0, -10)
  32. shadow.BackgroundTransparency = 1
  33. shadow.Parent = frame
  34.  
  35. -- Заголовок с возможностью перемещения
  36. local titleBar = Instance.new("Frame")
  37. titleBar.Size = UDim2.new(1, 0, 0, 36)
  38. titleBar.BackgroundColor3 = Color3.fromRGB(45, 45, 55)
  39. titleBar.BorderSizePixel = 0
  40. titleBar.Parent = frame
  41.  
  42. local titleCorner = Instance.new("UICorner")
  43. titleCorner.CornerRadius = UDim.new(0, 8)
  44. titleCorner.Parent = titleBar
  45.  
  46. local title = Instance.new("TextLabel")
  47. title.Text = "Управление полетом"
  48. title.Size = UDim2.new(1, -40, 1, 0)
  49. title.Position = UDim2.new(0, 10, 0, 0)
  50. title.BackgroundTransparency = 1
  51. title.TextColor3 = Color3.fromRGB(255, 255, 255)
  52. title.Font = Enum.Font.GothamBold
  53. title.TextSize = 16
  54. title.TextXAlignment = Enum.TextXAlignment.Left
  55. title.Parent = titleBar
  56.  
  57. local closeButton = Instance.new("TextButton")
  58. closeButton.Text = "×"
  59. closeButton.Size = UDim2.new(0, 36, 0, 36)
  60. closeButton.Position = UDim2.new(1, -36, 0, 0)
  61. closeButton.BackgroundTransparency = 1
  62. closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  63. closeButton.Font = Enum.Font.GothamBold
  64. closeButton.TextSize = 20
  65. closeButton.Parent = titleBar
  66.  
  67. -- Функция для создания полей ввода
  68. local function createInputField(parent, labelText, yOffset)
  69. local container = Instance.new("Frame")
  70. container.Size = UDim2.new(0.9, 0, 0, 60)
  71. container.Position = UDim2.new(0.05, 0, yOffset, 0)
  72. container.BackgroundTransparency = 1
  73. container.Parent = parent
  74.  
  75. local label = Instance.new("TextLabel")
  76. label.Text = labelText
  77. label.Size = UDim2.new(1, 0, 0, 20)
  78. label.BackgroundTransparency = 1
  79. label.TextColor3 = Color3.fromRGB(200, 200, 200)
  80. label.Font = Enum.Font.Gotham
  81. label.TextSize = 14
  82. label.TextXAlignment = Enum.TextXAlignment.Left
  83. label.Parent = container
  84.  
  85. local textBox = Instance.new("TextBox")
  86. textBox.Size = UDim2.new(1, 0, 0, 36)
  87. textBox.Position = UDim2.new(0, 0, 0, 24)
  88. textBox.BackgroundColor3 = Color3.fromRGB(50, 50, 60)
  89. textBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  90. textBox.PlaceholderText = "Введите " .. labelText
  91. textBox.Font = Enum.Font.Gotham
  92. textBox.TextSize = 14
  93. textBox.Parent = container
  94.  
  95. local boxCorner = Instance.new("UICorner")
  96. boxCorner.CornerRadius = UDim.new(0, 6)
  97. boxCorner.Parent = textBox
  98.  
  99. local boxStroke = Instance.new("UIStroke")
  100. boxStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  101. boxStroke.Color = Color3.fromRGB(80, 80, 90)
  102. boxStroke.Thickness = 1
  103. boxStroke.Parent = textBox
  104.  
  105. return textBox
  106. end
  107.  
  108. -- Создаем поля ввода
  109. local xBox = createInputField(frame, "X координата", 0.15)
  110. local yBox = createInputField(frame, "Y координата", 0.35)
  111. local zBox = createInputField(frame, "Z координата", 0.55)
  112.  
  113. -- Кнопка для полета
  114. local flyButton = Instance.new("TextButton")
  115. flyButton.Text = "Лететь к координатам"
  116. flyButton.Size = UDim2.new(0.9, 0, 0, 42)
  117. flyButton.Position = UDim2.new(0.05, 0, 0.78, 0)
  118. flyButton.BackgroundColor3 = Color3.fromRGB(0, 170, 255)
  119. flyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  120. flyButton.Font = Enum.Font.GothamBold
  121. flyButton.TextSize = 16
  122. flyButton.Parent = frame
  123.  
  124. local buttonCorner = Instance.new("UICorner")
  125. buttonCorner.CornerRadius = UDim.new(0, 6)
  126. buttonCorner.Parent = flyButton
  127.  
  128. local buttonStroke = Instance.new("UIStroke")
  129. buttonStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  130. buttonStroke.Color = Color3.fromRGB(0, 140, 255)
  131. buttonStroke.Thickness = 1
  132. buttonStroke.Parent = flyButton
  133.  
  134. -- Анимация при наведении на кнопку
  135. flyButton.MouseEnter:Connect(function()
  136. game:GetService("TweenService"):Create(
  137. flyButton,
  138. TweenInfo.new(0.2),
  139. {BackgroundColor3 = Color3.fromRGB(0, 190, 255)}
  140. ):Play()
  141. end)
  142.  
  143. flyButton.MouseLeave:Connect(function()
  144. game:GetService("TweenService"):Create(
  145. flyButton,
  146. TweenInfo.new(0.2),
  147. {BackgroundColor3 = Color3.fromRGB(0, 170, 255)}
  148. ):Play()
  149. end)
  150.  
  151. -- Функция для плавного полета к координатам
  152. local function flyToPosition(targetPosition)
  153. local character = player.Character or player.CharacterAdded:Wait()
  154. local humanoid = character:WaitForChild("Humanoid")
  155.  
  156. humanoid.PlatformStand = true
  157.  
  158. local bodyVelocity = Instance.new("BodyVelocity")
  159. bodyVelocity.Velocity = Vector3.new(0, 0, 0)
  160. bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  161. bodyVelocity.P = 1000
  162. bodyVelocity.Parent = character.HumanoidRootPart
  163.  
  164. local startPosition = character.HumanoidRootPart.Position
  165. local direction = (targetPosition - startPosition).Unit
  166. local distance = (targetPosition - startPosition).Magnitude
  167.  
  168. local speed = 50
  169. local startTime = tick()
  170. local duration = distance / speed
  171.  
  172. while tick() - startTime < duration do
  173. local elapsed = tick() - startTime
  174. local progress = elapsed / duration
  175. local currentPosition = startPosition + (targetPosition - startPosition) * progress
  176.  
  177. local remainingDistance = (targetPosition - character.HumanoidRootPart.Position).Magnitude
  178. local currentSpeed = speed
  179. if remainingDistance < 10 then
  180. currentSpeed = speed * (remainingDistance / 10)
  181. end
  182.  
  183. bodyVelocity.Velocity = direction * currentSpeed
  184. game:GetService("RunService").Heartbeat:Wait()
  185. end
  186.  
  187. character.HumanoidRootPart.CFrame = CFrame.new(targetPosition)
  188. bodyVelocity:Destroy()
  189. humanoid.PlatformStand = false
  190. end
  191.  
  192. -- Обработчик нажатия кнопки
  193. flyButton.MouseButton1Click:Connect(function()
  194. local x = tonumber(xBox.Text)
  195. local y = tonumber(yBox.Text)
  196. local z = tonumber(zBox.Text)
  197.  
  198. if x and y and z then
  199. local targetPosition = Vector3.new(x, y, z)
  200. flyToPosition(targetPosition)
  201. else
  202. -- Ошибка ввода
  203. local message = Instance.new("TextLabel")
  204. message.Text = "Пожалуйста, введите корректные числа!"
  205. message.Size = UDim2.new(0.9, 0, 0, 30)
  206. message.Position = UDim2.new(0.05, 0, 0.9, 0)
  207. message.BackgroundTransparency = 1
  208. message.TextColor3 = Color3.fromRGB(255, 80, 80)
  209. message.Font = Enum.Font.Gotham
  210. message.TextSize = 14
  211. message.Parent = frame
  212.  
  213. game:GetService("Debris"):AddItem(message, 3)
  214. end
  215. end)
  216.  
  217. -- Функционал перемещения окна
  218. local dragging
  219. local dragInput
  220. local dragStart
  221. local startPos
  222.  
  223. local function update(input)
  224. local delta = input.Position - dragStart
  225. frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  226. end
  227.  
  228. titleBar.InputBegan:Connect(function(input)
  229. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  230. dragging = true
  231. dragStart = input.Position
  232. startPos = frame.Position
  233.  
  234. input.Changed:Connect(function()
  235. if input.UserInputState == Enum.UserInputState.End then
  236. dragging = false
  237. end
  238. end)
  239. end
  240. end)
  241.  
  242. titleBar.InputChanged:Connect(function(input)
  243. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  244. dragInput = input
  245. end
  246. end)
  247.  
  248. game:GetService("UserInputService").InputChanged:Connect(function(input)
  249. if input == dragInput and dragging then
  250. update(input)
  251. end
  252. end)
  253.  
  254. -- Закрытие окна
  255. closeButton.MouseButton1Click:Connect(function()
  256. gui:Destroy()
  257. end)
  258.  
  259. local Players = game:GetService("Players")
  260. local UserInputService = game:GetService("UserInputService")
  261. local RunService = game:GetService("RunService")
  262. local player = Players.LocalPlayer
  263. local character = player.Character or player.CharacterAdded:Wait()
  264.  
  265. -- Создание GUI с красивым дизайном
  266. local ScreenGui = Instance.new("ScreenGui")
  267. local MainFrame = Instance.new("Frame")
  268. local TitleBar = Instance.new("Frame")
  269. local TitleLabel = Instance.new("TextLabel")
  270. local CloseButton = Instance.new("TextButton")
  271. local DragHandle = Instance.new("TextButton")
  272. local ContentFrame = Instance.new("Frame")
  273. local CoordinatesLabel = Instance.new("TextLabel")
  274. local CopyAllButton = Instance.new("TextButton")
  275. local CopyXButton = Instance.new("TextButton")
  276. local CopyYButton = Instance.new("TextButton")
  277. local CopyZButton = Instance.new("TextButton")
  278. local ToggleButton = Instance.new("TextButton")
  279.  
  280. ScreenGui.Name = "CoordinatesGUI"
  281. ScreenGui.Parent = player.PlayerGui
  282. ScreenGui.ResetOnSpawn = false
  283. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  284.  
  285. -- Основной фрейм
  286. MainFrame.Name = "MainFrame"
  287. MainFrame.Parent = ScreenGui
  288. MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
  289. MainFrame.BorderColor3 = Color3.fromRGB(60, 60, 80)
  290. MainFrame.BorderSizePixel = 2
  291. MainFrame.Position = UDim2.new(0.5, -110, 0.5, -80)
  292. MainFrame.Size = UDim2.new(0, 220, 0, 180)
  293. MainFrame.ClipsDescendants = true
  294.  
  295. -- Title bar
  296. TitleBar.Name = "TitleBar"
  297. TitleBar.Parent = MainFrame
  298. TitleBar.BackgroundColor3 = Color3.fromRGB(50, 50, 70)
  299. TitleBar.BorderSizePixel = 0
  300. TitleBar.Size = UDim2.new(1, 0, 0, 25)
  301.  
  302. TitleLabel.Name = "TitleLabel"
  303. TitleLabel.Parent = TitleBar
  304. TitleLabel.BackgroundTransparency = 1
  305. TitleLabel.Position = UDim2.new(0, 5, 0, 0)
  306. TitleLabel.Size = UDim2.new(1, -50, 1, 0)
  307. TitleLabel.Font = Enum.Font.GothamSemibold
  308. TitleLabel.Text = "Player Coordinates"
  309. TitleLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  310. TitleLabel.TextSize = 14
  311. TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
  312.  
  313. CloseButton.Name = "CloseButton"
  314. CloseButton.Parent = TitleBar
  315. CloseButton.BackgroundColor3 = Color3.fromRGB(70, 50, 50)
  316. CloseButton.BorderSizePixel = 0
  317. CloseButton.Position = UDim2.new(1, -25, 0, 0)
  318. CloseButton.Size = UDim2.new(0, 25, 0, 25)
  319. CloseButton.Font = Enum.Font.GothamBold
  320. CloseButton.Text = "X"
  321. CloseButton.TextColor3 = Color3.fromRGB(255, 220, 220)
  322. CloseButton.TextSize = 14
  323.  
  324. -- Drag handle (невидимый для перемещения)
  325. DragHandle.Name = "DragHandle"
  326. DragHandle.Parent = TitleBar
  327. DragHandle.BackgroundTransparency = 1
  328. DragHandle.Size = UDim2.new(1, -25, 1, 0)
  329. DragHandle.Text = ""
  330. DragHandle.ZIndex = 2
  331.  
  332. -- Content frame
  333. ContentFrame.Name = "ContentFrame"
  334. ContentFrame.Parent = MainFrame
  335. ContentFrame.BackgroundTransparency = 1
  336. ContentFrame.Position = UDim2.new(0, 0, 0, 25)
  337. ContentFrame.Size = UDim2.new(1, 0, 1, -25)
  338.  
  339. -- Coordinates label
  340. CoordinatesLabel.Name = "CoordinatesLabel"
  341. CoordinatesLabel.Parent = ContentFrame
  342. CoordinatesLabel.BackgroundTransparency = 1
  343. CoordinatesLabel.Position = UDim2.new(0.05, 0, 0.1, 0)
  344. CoordinatesLabel.Size = UDim2.new(0.9, 0, 0.3, 0)
  345. CoordinatesLabel.Font = Enum.Font.Gotham
  346. CoordinatesLabel.Text = "X: 0.00\nY: 0.00\nZ: 0.00"
  347. CoordinatesLabel.TextColor3 = Color3.fromRGB(220, 240, 255)
  348. CoordinatesLabel.TextSize = 16
  349. CoordinatesLabel.TextXAlignment = Enum.TextXAlignment.Left
  350. CoordinatesLabel.TextYAlignment = Enum.TextYAlignment.Top
  351.  
  352. -- Buttons
  353. local function createButton(name, text, position, size, color)
  354. local button = Instance.new("TextButton")
  355. button.Name = name
  356. button.Parent = ContentFrame
  357. button.BackgroundColor3 = color
  358. button.BorderSizePixel = 0
  359. button.Position = position
  360. button.Size = size
  361. button.Font = Enum.Font.GothamSemibold
  362. button.Text = text
  363. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  364. button.TextSize = 14
  365. button.AutoButtonColor = true
  366.  
  367. -- Эффект при наведении
  368. local originalColor = color
  369. local hoverColor = Color3.new(
  370. math.min(originalColor.R * 1.3, 1),
  371. math.min(originalColor.G * 1.3, 1),
  372. math.min(originalColor.B * 1.3, 1)
  373. )
  374.  
  375. button.MouseEnter:Connect(function()
  376. button.BackgroundColor3 = hoverColor
  377. end)
  378.  
  379. button.MouseLeave:Connect(function()
  380. button.BackgroundColor3 = originalColor
  381. end)
  382.  
  383. return button
  384. end
  385.  
  386. CopyAllButton = createButton(
  387. "CopyAllButton",
  388. "Copy All",
  389. UDim2.new(0.05, 0, 0.45, 0),
  390. UDim2.new(0.9, 0, 0.15, 0),
  391. Color3.fromRGB(60, 80, 100)
  392. )
  393.  
  394. CopyXButton = createButton(
  395. "CopyXButton",
  396. "Copy X",
  397. UDim2.new(0.05, 0, 0.65, 0),
  398. UDim2.new(0.28, 0, 0.15, 0),
  399. Color3.fromRGB(100, 60, 80)
  400. )
  401.  
  402. CopyYButton = createButton(
  403. "CopyYButton",
  404. "Copy Y",
  405. UDim2.new(0.37, 0, 0.65, 0),
  406. UDim2.new(0.28, 0, 0.15, 0),
  407. Color3.fromRGB(80, 100, 60)
  408. )
  409.  
  410. CopyZButton = createButton(
  411. "CopyZButton",
  412. "Copy Z",
  413. UDim2.new(0.69, 0, 0.65, 0),
  414. UDim2.new(0.28, 0, 0.15, 0),
  415. Color3.fromRGB(60, 80, 100)
  416. )
  417.  
  418. ToggleButton = createButton(
  419. "ToggleButton",
  420. "Hide",
  421. UDim2.new(0.05, 0, 0.85, 0),
  422. UDim2.new(0.9, 0, 0.15, 0),
  423. Color3.fromRGB(80, 60, 100)
  424. )
  425.  
  426. -- Функции
  427. local function updateCoordinates()
  428. if character and character:FindFirstChild("HumanoidRootPart") then
  429. local position = character.HumanoidRootPart.Position
  430. CoordinatesLabel.Text = string.format("X: %.2f\nY: %.2f\nZ: %.2f", position.X, position.Y, position.Z)
  431. return position
  432. end
  433. return nil
  434. end
  435.  
  436. local function copyToClipboard(text)
  437. local clipboard = setclipboard or toclipboard or set_clipboard or (Clipboard and Clipboard.set)
  438. if clipboard then
  439. clipboard(text)
  440. else
  441. warn("Clipboard function not found")
  442. end
  443. end
  444.  
  445. -- Перемещение GUI
  446. local dragging = false
  447. local dragStartPos, frameStartPos
  448.  
  449. DragHandle.InputBegan:Connect(function(input)
  450. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  451. dragging = true
  452. dragStartPos = input.Position
  453. frameStartPos = MainFrame.Position
  454. end
  455. end)
  456.  
  457. UserInputService.InputChanged:Connect(function(input)
  458. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  459. local delta = input.Position - dragStartPos
  460. MainFrame.Position = UDim2.new(
  461. frameStartPos.X.Scale,
  462. frameStartPos.X.Offset + delta.X,
  463. frameStartPos.Y.Scale,
  464. frameStartPos.Y.Offset + delta.Y
  465. )
  466. end
  467. end)
  468.  
  469. UserInputService.InputEnded:Connect(function(input)
  470. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  471. dragging = false
  472. end
  473. end)
  474.  
  475. -- Обработчики кнопок
  476. CopyAllButton.MouseButton1Click:Connect(function()
  477. local position = updateCoordinates()
  478. if position then
  479. copyToClipboard(string.format("%.2f, %.2f, %.2f", position.X, position.Y, position.Z))
  480. end
  481. end)
  482.  
  483. CopyXButton.MouseButton1Click:Connect(function()
  484. local position = updateCoordinates()
  485. if position then
  486. copyToClipboard(tostring(position.X))
  487. end
  488. end)
  489.  
  490. CopyYButton.MouseButton1Click:Connect(function()
  491. local position = updateCoordinates()
  492. if position then
  493. copyToClipboard(tostring(position.Y))
  494. end
  495. end)
  496.  
  497. CopyZButton.MouseButton1Click:Connect(function()
  498. local position = updateCoordinates()
  499. if position then
  500. copyToClipboard(tostring(position.Z))
  501. end
  502. end)
  503.  
  504. CloseButton.MouseButton1Click:Connect(function()
  505. ScreenGui:Destroy()
  506. end)
  507.  
  508. local isVisible = true
  509. ToggleButton.MouseButton1Click:Connect(function()
  510. isVisible = not isVisible
  511. MainFrame.Visible = isVisible
  512. ToggleButton.Text = isVisible and "Hide" or "Show"
  513. end)
  514.  
  515. -- Автоматическое обновление координат
  516. RunService.Heartbeat:Connect(function()
  517. updateCoordinates()
  518. end)
  519.  
  520. -- Обработка смерти/респавна персонажа
  521. player.CharacterAdded:Connect(function(newCharacter)
  522. character = newCharacter
  523. character:WaitForChild("HumanoidRootPart")
  524. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement