GGez1488

Untitled

Jul 29th, 2025 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.96 KB | None | 0 0
  1. -- Локальные переменные
  2. local UserInputService = game:GetService("UserInputService")
  3. local Players = game:GetService("Players")
  4. local player = Players.LocalPlayer
  5.  
  6. -- Создаем GUI
  7. local ScreenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
  8. ScreenGui.Name = "DrawGUI"
  9.  
  10. -- Функция для перемещения GUI
  11. local function makeDraggable(frame)
  12.     local dragging, dragInput, dragStart, startPos
  13.  
  14.     local function update(input)
  15.         local delta = input.Position - dragStart
  16.         frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
  17.                                    startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  18.     end
  19.  
  20.     frame.InputBegan:Connect(function(input)
  21.         if input.UserInputType == Enum.UserInputType.MouseButton1 then
  22.             dragging = true
  23.             dragStart = input.Position
  24.             startPos = frame.Position
  25.  
  26.             input.Changed:Connect(function()
  27.                 if input.UserInputState == Enum.UserInputState.End then
  28.                     dragging = false
  29.                 end
  30.             end)
  31.         end
  32.     end)
  33.  
  34.     frame.InputChanged:Connect(function(input)
  35.         if input.UserInputType == Enum.UserInputType.MouseMovement then
  36.             dragInput = input
  37.         end
  38.     end)
  39.  
  40.     UserInputService.InputChanged:Connect(function(input)
  41.         if input == dragInput and dragging then
  42.             update(input)
  43.         end
  44.     end)
  45. end
  46.  
  47. -- Кнопка для открытия меню
  48. local openButton = Instance.new("TextButton")
  49. openButton.Size = UDim2.new(0, 120, 0, 40)
  50. openButton.Position = UDim2.new(0, 20, 0, 20)
  51. openButton.Text = "🖼 Открыть меню"
  52. openButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  53. openButton.TextColor3 = Color3.fromRGB(255,255,255)
  54. openButton.Parent = ScreenGui
  55. makeDraggable(openButton)
  56.  
  57. -- GUI-меню
  58. local menu = Instance.new("Frame")
  59. menu.Size = UDim2.new(0, 320, 0, 160)
  60. menu.Position = UDim2.new(0, 20, 0, 80)
  61. menu.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  62. menu.Visible = false
  63. menu.Parent = ScreenGui
  64. makeDraggable(menu)
  65.  
  66. -- Поле для ввода URL
  67. local input = Instance.new("TextBox")
  68. input.Size = UDim2.new(0, 280, 0, 30)
  69. input.Position = UDim2.new(0, 20, 0, 20)
  70. input.PlaceholderText = "Прямая ссылка на .jpg / .png"
  71. input.TextColor3 = Color3.new(1,1,1)
  72. input.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  73. input.ClearTextOnFocus = false
  74. input.Text = ""
  75. input.Parent = menu
  76.  
  77. -- Кнопка "Рисовать"
  78. local drawBtn = Instance.new("TextButton")
  79. drawBtn.Size = UDim2.new(0, 120, 0, 40)
  80. drawBtn.Position = UDim2.new(0.5, -60, 0, 70)
  81. drawBtn.Text = "🎨 Нарисовать"
  82. drawBtn.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  83. drawBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
  84. drawBtn.Parent = menu
  85.  
  86. -- Клик по кнопке меню
  87. openButton.MouseButton1Click:Connect(function()
  88.     menu.Visible = not menu.Visible
  89. end)
  90.  
  91. -- Нажатие на "Нарисовать"
  92. drawBtn.MouseButton1Click:Connect(function()
  93.     local url = input.Text
  94.     if not url or url == "" then
  95.         warn("Ссылка пустая, брат.")
  96.         return
  97.     end
  98.  
  99.     if not (url:match("%.jpg$") or url:match("%.png$") or url:match("%.jpeg$")) then
  100.         warn("Это не прямая ссылка на изображение.")
  101.         return
  102.     end
  103.  
  104.     -- Рисуем на простом Part’е с Decal
  105.     local part = Instance.new("Part")
  106.     part.Size = Vector3.new(10, 7, 0.2)
  107.     part.Anchored = true
  108.     part.Position = player.Character and (player.Character.HumanoidRootPart.Position + Vector3.new(0, 5, -10)) or Vector3.new(0, 5, 0)
  109.     part.Parent = workspace
  110.     part.Name = "ImageSurface"
  111.  
  112.     local decal = Instance.new("Decal")
  113.     decal.Texture = url
  114.     decal.Face = Enum.NormalId.Front
  115.     decal.Parent = part
  116.  
  117.     print("Попытка загрузки изображения: ", url)
  118. end)
Advertisement
Add Comment
Please, Sign In to add comment