Advertisement
kill21_2

тп на свой мир

Apr 25th, 2025
3,324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.46 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local UserInputService = game:GetService("UserInputService")
  3. local TweenService = game:GetService("TweenService")
  4.  
  5. local player = Players.LocalPlayer
  6. local character = player.Character or player.CharacterAdded:Wait()
  7.  
  8. -- Создаем ScreenGui с красивым дизайном
  9. local screenGui = Instance.new("ScreenGui")
  10. screenGui.Name = "TeleportGUI"
  11. screenGui.Parent = game:GetService("CoreGui")
  12.  
  13. -- Основной фрейм с закругленными углами и тенью
  14. local frame = Instance.new("Frame")
  15. frame.Size = UDim2.new(0, 320, 0, 220)
  16. frame.Position = UDim2.new(0.5, -160, 0.5, -110)
  17. frame.AnchorPoint = Vector2.new(0.5, 0.5)
  18. frame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
  19. frame.BorderSizePixel = 0
  20. frame.Parent = screenGui
  21.  
  22. -- Закругление углов
  23. local corner = Instance.new("UICorner")
  24. corner.CornerRadius = UDim.new(0, 8)
  25. corner.Parent = frame
  26.  
  27. -- Тень
  28. local shadow = Instance.new("ImageLabel")
  29. shadow.Name = "Shadow"
  30. shadow.Size = UDim2.new(1, 10, 1, 10)
  31. shadow.Position = UDim2.new(0, -5, 0, -5)
  32. shadow.BackgroundTransparency = 1
  33. shadow.Image = "rbxassetid://1316045217"
  34. shadow.ImageColor3 = Color3.new(0, 0, 0)
  35. shadow.ImageTransparency = 0.8
  36. shadow.ScaleType = Enum.ScaleType.Slice
  37. shadow.SliceCenter = Rect.new(10, 10, 118, 118)
  38. shadow.Parent = frame
  39.  
  40. -- Заголовок с градиентом
  41. local title = Instance.new("TextLabel")
  42. title.Size = UDim2.new(1, 0, 0, 40)
  43. title.Position = UDim2.new(0, 0, 0, 0)
  44. title.BackgroundColor3 = Color3.fromRGB(45, 45, 60)
  45. title.Text = "Телепортатор"
  46. title.TextColor3 = Color3.fromRGB(255, 255, 255)
  47. title.Font = Enum.Font.GothamBold
  48. title.TextSize = 20
  49. title.Parent = frame
  50.  
  51. -- Закругление углов заголовка
  52. local titleCorner = Instance.new("UICorner")
  53. titleCorner.CornerRadius = UDim.new(0, 8)
  54. titleCorner.Parent = title
  55.  
  56. -- Градиент для заголовка
  57. local gradient = Instance.new("UIGradient")
  58. gradient.Color = ColorSequence.new({
  59. ColorSequenceKeypoint.new(0, Color3.fromRGB(80, 120, 200)),
  60. ColorSequenceKeypoint.new(1, Color3.fromRGB(100, 140, 220))
  61. })
  62. gradient.Rotation = 90
  63. gradient.Parent = title
  64.  
  65. -- Текст с информацией о телепортации
  66. local coordsLabel = Instance.new("TextLabel")
  67. coordsLabel.Size = UDim2.new(1, -20, 0, 80)
  68. coordsLabel.Position = UDim2.new(0, 10, 0, 50)
  69. coordsLabel.BackgroundTransparency = 1
  70. coordsLabel.Text = "Тп на безопасное место\n\nКоординаты:\nX: -89.83 Y: 509.832 Z: 1520.155"
  71. coordsLabel.TextColor3 = Color3.fromRGB(220, 220, 255)
  72. coordsLabel.Font = Enum.Font.Gotham
  73. coordsLabel.TextSize = 16
  74. coordsLabel.TextXAlignment = Enum.TextXAlignment.Left
  75. coordsLabel.TextYAlignment = Enum.TextYAlignment.Top
  76. coordsLabel.Parent = frame
  77.  
  78. -- Иконка безопасного места
  79. local safeIcon = Instance.new("ImageLabel")
  80. safeIcon.Size = UDim2.new(0, 40, 0, 40)
  81. safeIcon.Position = UDim2.new(1, -50, 0, 55)
  82. safeIcon.BackgroundTransparency = 1
  83. safeIcon.Image = "rbxassetid://3944680095" -- Иконка щита (можно заменить на другую)
  84. safeIcon.ImageColor3 = Color3.fromRGB(100, 200, 100)
  85. safeIcon.Parent = frame
  86.  
  87. -- Кнопка телепортации с анимацией
  88. local teleportButton = Instance.new("TextButton")
  89. teleportButton.Size = UDim2.new(0.8, 0, 0, 45)
  90. teleportButton.Position = UDim2.new(0.1, 0, 0.75, 0)
  91. teleportButton.BackgroundColor3 = Color3.fromRGB(80, 160, 80)
  92. teleportButton.Text = "ТЕЛЕПОРТИРОВАТЬСЯ"
  93. teleportButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  94. teleportButton.Font = Enum.Font.GothamBold
  95. teleportButton.TextSize = 18
  96. teleportButton.AutoButtonColor = false
  97. teleportButton.Parent = frame
  98.  
  99. -- Закругление кнопки
  100. local buttonCorner = Instance.new("UICorner")
  101. buttonCorner.CornerRadius = UDim.new(0, 6)
  102. buttonCorner.Parent = teleportButton
  103.  
  104. -- Анимация кнопки при наведении
  105. teleportButton.MouseEnter:Connect(function()
  106. TweenService:Create(teleportButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(100, 180, 100)}):Play()
  107. end)
  108.  
  109. teleportButton.MouseLeave:Connect(function()
  110. TweenService:Create(teleportButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(80, 160, 80)}):Play()
  111. end)
  112.  
  113. -- Функция телепортации с эффектом
  114. teleportButton.MouseButton1Click:Connect(function()
  115. if character and character:FindFirstChild("HumanoidRootPart") then
  116. -- Анимация нажатия
  117. TweenService:Create(teleportButton, TweenInfo.new(0.1), {Size = UDim2.new(0.75, 0, 0, 40)}):Play()
  118. wait(0.1)
  119. TweenService:Create(teleportButton, TweenInfo.new(0.1), {Size = UDim2.new(0.8, 0, 0, 45)}):Play()
  120.  
  121. -- Телепортация
  122. character.HumanoidRootPart.CFrame = CFrame.new(-89.83, 509.832, 1520.155)
  123.  
  124. -- Эффект подтверждения
  125. teleportButton.Text = "УСПЕШНО!"
  126. TweenService:Create(teleportButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(100, 200, 100)}):Play()
  127. wait(1)
  128. teleportButton.Text = "ТЕЛЕПОРТИРОВАТЬСЯ"
  129. TweenService:Create(teleportButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(80, 160, 80)}):Play()
  130. else
  131. teleportButton.Text = "ОШИБКА!"
  132. TweenService:Create(teleportButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(200, 80, 80)}):Play()
  133. wait(1)
  134. teleportButton.Text = "ТЕЛЕПОРТИРОВАТЬСЯ"
  135. TweenService:Create(teleportButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(80, 160, 80)}):Play()
  136. end
  137. end)
  138.  
  139. -- Кнопка закрытия с анимацией
  140. local closeButton = Instance.new("TextButton")
  141. closeButton.Size = UDim2.new(0, 30, 0, 30)
  142. closeButton.Position = UDim2.new(1, -35, 0, 5)
  143. closeButton.BackgroundColor3 = Color3.fromRGB(200, 70, 70)
  144. closeButton.Text = "×"
  145. closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  146. closeButton.Font = Enum.Font.GothamBold
  147. closeButton.TextSize = 24
  148. closeButton.Parent = frame
  149.  
  150. -- Закругление кнопки закрытия
  151. local closeCorner = Instance.new("UICorner")
  152. closeCorner.CornerRadius = UDim.new(0, 15)
  153. closeCorner.Parent = closeButton
  154.  
  155. -- Анимация кнопки закрытия
  156. closeButton.MouseEnter:Connect(function()
  157. TweenService:Create(closeButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(220, 90, 90)}):Play()
  158. end)
  159.  
  160. closeButton.MouseLeave:Connect(function()
  161. TweenService:Create(closeButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(200, 70, 70)}):Play()
  162. end)
  163.  
  164. -- Функционал перемещения GUI
  165. local dragging = false
  166. local dragInput, dragStart, startPos
  167.  
  168. local function update(input)
  169. local delta = input.Position - dragStart
  170. frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  171. end
  172.  
  173. title.InputBegan:Connect(function(input)
  174. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  175. dragging = true
  176. dragStart = input.Position
  177. startPos = frame.Position
  178.  
  179. input.Changed:Connect(function()
  180. if input.UserInputState == Enum.UserInputState.End then
  181. dragging = false
  182. end
  183. end)
  184. end
  185. end)
  186.  
  187. title.InputChanged:Connect(function(input)
  188. if input.UserInputType == Enum.UserInputType.MouseMovement and dragging then
  189. dragInput = input
  190. end
  191. end)
  192.  
  193. UserInputService.InputChanged:Connect(function(input)
  194. if input == dragInput and dragging then
  195. update(input)
  196. end
  197. end)
  198.  
  199. closeButton.MouseButton1Click:Connect(function()
  200. TweenService:Create(frame, TweenInfo.new(0.2), {Size = UDim2.new(0, 0, 0, 0)}):Play()
  201. wait(0.2)
  202. screenGui:Destroy()
  203. end)
  204.  
  205. local Players = game:GetService("Players")
  206. local UserInputService = game:GetService("UserInputService")
  207. local TweenService = game:GetService("TweenService")
  208.  
  209. local player = Players.LocalPlayer
  210. local mouse = player:GetMouse()
  211.  
  212. -- Создаем основной интерфейс
  213. local ScreenGui = Instance.new("ScreenGui")
  214. ScreenGui.Name = "WorldCreatorUI"
  215. ScreenGui.Parent = game.CoreGui
  216. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  217.  
  218. -- Главный фрейм
  219. local MainFrame = Instance.new("Frame")
  220. MainFrame.Name = "MainFrame"
  221. MainFrame.Parent = ScreenGui
  222. MainFrame.BackgroundColor3 = Color3.fromRGB(30, 35, 45)
  223. MainFrame.BorderSizePixel = 0
  224. MainFrame.Position = UDim2.new(0.3, 0, 0.3, 0)
  225. MainFrame.Size = UDim2.new(0, 300, 0, 350)
  226. MainFrame.ZIndex = 2
  227.  
  228. -- Скругление углов
  229. local UICorner = Instance.new("UICorner")
  230. UICorner.CornerRadius = UDim.new(0, 12)
  231. UICorner.Parent = MainFrame
  232.  
  233. -- Тень для эффекта глубины
  234. local DropShadow = Instance.new("ImageLabel")
  235. DropShadow.Name = "DropShadow"
  236. DropShadow.Parent = MainFrame
  237. DropShadow.AnchorPoint = Vector2.new(0.5, 0.5)
  238. DropShadow.BackgroundTransparency = 1
  239. DropShadow.BorderSizePixel = 0
  240. DropShadow.Position = UDim2.new(0.5, 0, 0.5, 4)
  241. DropShadow.Size = UDim2.new(1, 24, 1, 24)
  242. DropShadow.ZIndex = 1
  243. DropShadow.Image = "rbxassetid://1316045217"
  244. DropShadow.ImageColor3 = Color3.fromRGB(0, 0, 0)
  245. DropShadow.ImageTransparency = 0.88
  246. DropShadow.ScaleType = Enum.ScaleType.Slice
  247. DropShadow.SliceCenter = Rect.new(10, 10, 118, 118)
  248.  
  249. -- Заголовок
  250. local TitleBar = Instance.new("Frame")
  251. TitleBar.Name = "TitleBar"
  252. TitleBar.Parent = MainFrame
  253. TitleBar.BackgroundColor3 = Color3.fromRGB(40, 45, 60)
  254. TitleBar.BorderSizePixel = 0
  255. TitleBar.Size = UDim2.new(1, 0, 0, 40)
  256. TitleBar.ZIndex = 3
  257.  
  258. local TitleCorner = Instance.new("UICorner")
  259. TitleCorner.CornerRadius = UDim.new(0, 12)
  260. TitleCorner.Parent = TitleBar
  261.  
  262. local Title = Instance.new("TextLabel")
  263. Title.Name = "Title"
  264. Title.Parent = TitleBar
  265. Title.BackgroundTransparency = 1
  266. Title.Position = UDim2.new(0, 15, 0, 0)
  267. Title.Size = UDim2.new(1, -30, 1, 0)
  268. Title.Font = Enum.Font.GothamBold
  269. Title.Text = "СОЗДАТЬ СВОЙ МИР"
  270. Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  271. Title.TextSize = 16
  272. Title.TextXAlignment = Enum.TextXAlignment.Left
  273. Title.ZIndex = 4
  274.  
  275. -- Кнопка закрытия
  276. local CloseButton = Instance.new("TextButton")
  277. CloseButton.Name = "CloseButton"
  278. CloseButton.Parent = TitleBar
  279. CloseButton.AnchorPoint = Vector2.new(1, 0.5)
  280. CloseButton.BackgroundColor3 = Color3.fromRGB(255, 60, 60)
  281. CloseButton.BorderSizePixel = 0
  282. CloseButton.Position = UDim2.new(1, -10, 0.5, 0)
  283. CloseButton.Size = UDim2.new(0, 20, 0, 20)
  284. CloseButton.Font = Enum.Font.GothamBold
  285. CloseButton.Text = "×"
  286. CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  287. CloseButton.TextSize = 18
  288. CloseButton.ZIndex = 4
  289.  
  290. local CloseCorner = Instance.new("UICorner")
  291. CloseCorner.CornerRadius = UDim.new(1, 0)
  292. CloseCorner.Parent = CloseButton
  293.  
  294. -- Основное содержимое
  295. local ContentFrame = Instance.new("Frame")
  296. ContentFrame.Name = "ContentFrame"
  297. ContentFrame.Parent = MainFrame
  298. ContentFrame.BackgroundTransparency = 1
  299. ContentFrame.Position = UDim2.new(0, 15, 0, 50)
  300. ContentFrame.Size = UDim2.new(1, -30, 1, -65)
  301. ContentFrame.ZIndex = 3
  302.  
  303. -- Иконка
  304. local Icon = Instance.new("ImageLabel")
  305. Icon.Name = "Icon"
  306. Icon.Parent = ContentFrame
  307. Icon.AnchorPoint = Vector2.new(0.5, 0)
  308. Icon.BackgroundTransparency = 1
  309. Icon.Position = UDim2.new(0.5, 0, 0, 0)
  310. Icon.Size = UDim2.new(0, 100, 0, 100)
  311. Icon.Image = "rbxassetid://7072718362" -- Можно заменить на свою иконку
  312. Icon.ZIndex = 3
  313.  
  314. -- Описание
  315. local Description = Instance.new("TextLabel")
  316. Description.Name = "Description"
  317. Description.Parent = ContentFrame
  318. Description.BackgroundTransparency = 1
  319. Description.Position = UDim2.new(0, 0, 0, 110)
  320. Description.Size = UDim2.new(1, 0, 0, 60)
  321. Description.Font = Enum.Font.Gotham
  322. Description.Text = "Создайте уникальный мир с помощью этого инструмента. Нажмите кнопку ниже, чтобы начать!"
  323. Description.TextColor3 = Color3.fromRGB(200, 200, 210)
  324. Description.TextSize = 14
  325. Description.TextWrapped = true
  326. Description.ZIndex = 3
  327.  
  328. -- Главная кнопка
  329. local MainButton = Instance.new("TextButton")
  330. MainButton.Name = "MainButton"
  331. MainButton.Parent = ContentFrame
  332. MainButton.AnchorPoint = Vector2.new(0.5, 1)
  333. MainButton.BackgroundColor3 = Color3.fromRGB(80, 120, 200)
  334. MainButton.BorderSizePixel = 0
  335. MainButton.Position = UDim2.new(0.5, 0, 1, 0)
  336. MainButton.Size = UDim2.new(1, 0, 0, 40)
  337. MainButton.Font = Enum.Font.GothamBold
  338. MainButton.Text = "СОЗДАТЬ МИР"
  339. MainButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  340. MainButton.TextSize = 14
  341. MainButton.ZIndex = 3
  342.  
  343. local ButtonCorner = Instance.new("UICorner")
  344. ButtonCorner.CornerRadius = UDim.new(0, 8)
  345. ButtonCorner.Parent = MainButton
  346.  
  347. -- Анимация при наведении
  348. MainButton.MouseEnter:Connect(function()
  349. TweenService:Create(
  350. MainButton,
  351. TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
  352. {BackgroundColor3 = Color3.fromRGB(100, 140, 220)}
  353. ):Play()
  354. end)
  355.  
  356. MainButton.MouseLeave:Connect(function()
  357. TweenService:Create(
  358. MainButton,
  359. TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
  360. {BackgroundColor3 = Color3.fromRGB(80, 120, 200)}
  361. ):Play()
  362. end)
  363.  
  364. -- Функционал кнопки
  365. MainButton.MouseButton1Click:Connect(function()
  366. loadstring(game:HttpGet('https://pastebin.com/raw/Y0QJjskj'))()
  367.  
  368. -- Анимация нажатия
  369. TweenService:Create(
  370. MainButton,
  371. TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
  372. {BackgroundColor3 = Color3.fromRGB(60, 100, 180)}
  373. ):Play()
  374. wait(0.1)
  375. TweenService:Create(
  376. MainButton,
  377. TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
  378. {BackgroundColor3 = Color3.fromRGB(80, 120, 200)}
  379. ):Play()
  380.  
  381. -- Временное изменение текста
  382. local originalText = MainButton.Text
  383. MainButton.Text = "МИР СОЗДАЕТСЯ..."
  384. wait(2)
  385. MainButton.Text = originalText
  386. end)
  387.  
  388. -- Закрытие интерфейса
  389. CloseButton.MouseButton1Click:Connect(function()
  390. ScreenGui:Destroy()
  391. end)
  392.  
  393. -- Функционал перемещения
  394. local dragging
  395. local dragInput
  396. local dragStart
  397. local startPos
  398.  
  399. local function update(input)
  400. local delta = input.Position - dragStart
  401. MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  402. end
  403.  
  404. TitleBar.InputBegan:Connect(function(input)
  405. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  406. dragging = true
  407. dragStart = input.Position
  408. startPos = MainFrame.Position
  409.  
  410. input.Changed:Connect(function()
  411. if input.UserInputState == Enum.UserInputState.End then
  412. dragging = false
  413. end
  414. end)
  415. end
  416. end)
  417.  
  418. TitleBar.InputChanged:Connect(function(input)
  419. if input.UserInputType == Enum.UserInputType.MouseMovement then
  420. dragInput = input
  421. end
  422. end)
  423.  
  424. UserInputService.InputChanged:Connect(function(input)
  425. if input == dragInput and dragging then
  426. update(input)
  427. end
  428. end)
  429.  
  430. local player = game.Players.LocalPlayer
  431. local UserInputService = game:GetService("UserInputService")
  432. local RunService = game:GetService("RunService")
  433.  
  434. -- Ожидаем загрузку персонажа
  435. local character = player.Character or player.CharacterAdded:Wait()
  436. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  437.  
  438. local savedPosition = nil
  439. local dragging = false
  440. local dragOffset = Vector2.new(0, 0)
  441.  
  442. -- Создаем красивый интерфейс
  443. local screenGui = Instance.new("ScreenGui")
  444. screenGui.Name = "TeleportUI"
  445. screenGui.ResetOnSpawn = false
  446.  
  447. local mainFrame = Instance.new("Frame")
  448. mainFrame.Name = "MainFrame"
  449. mainFrame.Size = UDim2.new(0, 250, 0, 180)
  450. mainFrame.Position = UDim2.new(0.5, -125, 0.5, -90)
  451. mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  452. mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 40)
  453. mainFrame.BackgroundTransparency = 0.2
  454. mainFrame.BorderSizePixel = 0
  455. mainFrame.ClipsDescendants = true
  456.  
  457. local corner = Instance.new("UICorner")
  458. corner.CornerRadius = UDim.new(0, 8)
  459. corner.Parent = mainFrame
  460.  
  461. local titleBar = Instance.new("Frame")
  462. titleBar.Name = "TitleBar"
  463. titleBar.Size = UDim2.new(1, 0, 0, 30)
  464. titleBar.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
  465. titleBar.BorderSizePixel = 0
  466.  
  467. local titleCorner = Instance.new("UICorner")
  468. titleCorner.CornerRadius = UDim.new(0, 8)
  469. titleCorner.Parent = titleBar
  470.  
  471. local title = Instance.new("TextLabel")
  472. title.Name = "Title"
  473. title.Size = UDim2.new(1, -10, 1, 0)
  474. title.Position = UDim2.new(0, 10, 0, 0)
  475. title.BackgroundTransparency = 1
  476. title.Text = "Телепорт"
  477. title.TextColor3 = Color3.fromRGB(255, 255, 255)
  478. title.TextXAlignment = Enum.TextXAlignment.Left
  479. title.Font = Enum.Font.GothamBold
  480. title.TextSize = 14
  481.  
  482. local statusLabel = Instance.new("TextLabel")
  483. statusLabel.Name = "StatusLabel"
  484. statusLabel.Size = UDim2.new(1, -20, 0, 40)
  485. statusLabel.Position = UDim2.new(0, 10, 0, 40)
  486. statusLabel.BackgroundTransparency = 1
  487. statusLabel.Text = "Нажмите кнопку, чтобы сохранить позицию"
  488. statusLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
  489. statusLabel.TextXAlignment = Enum.TextXAlignment.Left
  490. statusLabel.Font = Enum.Font.Gotham
  491. statusLabel.TextSize = 12
  492. statusLabel.TextWrapped = true
  493.  
  494. local teleportButton = Instance.new("TextButton")
  495. teleportButton.Name = "TeleportButton"
  496. teleportButton.Size = UDim2.new(1, -20, 0, 40)
  497. teleportButton.Position = UDim2.new(0, 10, 0, 90)
  498. teleportButton.BackgroundColor3 = Color3.fromRGB(0, 120, 215)
  499. teleportButton.Text = "Сохранить позицию"
  500. teleportButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  501. teleportButton.Font = Enum.Font.GothamBold
  502. teleportButton.TextSize = 14
  503.  
  504. local buttonCorner = Instance.new("UICorner")
  505. buttonCorner.CornerRadius = UDim.new(0, 6)
  506. buttonCorner.Parent = teleportButton
  507.  
  508. local closeButton = Instance.new("TextButton")
  509. closeButton.Name = "CloseButton"
  510. closeButton.Size = UDim2.new(0, 20, 0, 20)
  511. closeButton.Position = UDim2.new(1, -25, 0, 5)
  512. closeButton.BackgroundTransparency = 1
  513. closeButton.Text = "×"
  514. closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  515. closeButton.Font = Enum.Font.GothamBold
  516. closeButton.TextSize = 18
  517.  
  518. -- Собираем интерфейс
  519. title.Parent = titleBar
  520. titleBar.Parent = mainFrame
  521. statusLabel.Parent = mainFrame
  522. teleportButton.Parent = mainFrame
  523. closeButton.Parent = mainFrame
  524. mainFrame.Parent = screenGui
  525. screenGui.Parent = player.PlayerGui
  526.  
  527. -- Функция для обновления статуса
  528. local function updateStatus()
  529. if savedPosition then
  530. statusLabel.Text = string.format(
  531. "Позиция сохранена:\nX: %.1f, Y: %.1f, Z: %.1f\nНажмите, чтобы телепортироваться",
  532. savedPosition.X, savedPosition.Y, savedPosition.Z
  533. )
  534. teleportButton.Text = "Телепортироваться"
  535. teleportButton.BackgroundColor3 = Color3.fromRGB(0, 180, 100)
  536. else
  537. statusLabel.Text = "Позиция не сохранена\nНажмите кнопку, чтобы сохранить текущую позицию"
  538. teleportButton.Text = "Сохранить позицию"
  539. teleportButton.BackgroundColor3 = Color3.fromRGB(0, 120, 215)
  540. end
  541. end
  542.  
  543. -- Функция переключения телепорта
  544. local function toggleTeleport()
  545. if not savedPosition then
  546. -- Сохраняем текущую позицию
  547. savedPosition = humanoidRootPart.Position
  548. else
  549. -- Телепортируем к сохраненной позиции
  550. humanoidRootPart.CFrame = CFrame.new(savedPosition)
  551. savedPosition = nil
  552. end
  553. updateStatus()
  554. end
  555.  
  556. -- Обработчики событий для перемещения окна
  557. titleBar.InputBegan:Connect(function(input)
  558. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  559. dragging = true
  560. local mousePos = UserInputService:GetMouseLocation()
  561. local framePos = mainFrame.AbsolutePosition
  562. dragOffset = Vector2.new(mousePos.X - framePos.X, mousePos.Y - framePos.Y)
  563. end
  564. end)
  565.  
  566. UserInputService.InputChanged:Connect(function(input)
  567. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  568. local mousePos = UserInputService:GetMouseLocation()
  569. mainFrame.Position = UDim2.new(
  570. 0, mousePos.X - dragOffset.X,
  571. 0, mousePos.Y - dragOffset.Y
  572. )
  573. end
  574. end)
  575.  
  576. UserInputService.InputEnded:Connect(function(input)
  577. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  578. dragging = false
  579. end
  580. end)
  581.  
  582. -- Обработчики кнопок
  583. teleportButton.MouseButton1Click:Connect(toggleTeleport)
  584. closeButton.MouseButton1Click:Connect(function()
  585. screenGui:Destroy()
  586. end)
  587.  
  588. -- Инициализация
  589. updateStatus()
  590.  
  591. -- Дополнительно: горячая клавиша (T)
  592. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  593. if input.KeyCode == Enum.KeyCode.T and not gameProcessed then
  594. toggleTeleport()
  595. end
  596. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement