Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ScreenGui = Instance.new("ScreenGui")
- local Frame = Instance.new("Frame")
- local DrawingArea = Instance.new("Frame")
- ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- Frame.Parent = ScreenGui
- Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- Frame.Size = UDim2.new(0.8, 0, 0.8, 0) -- Уменьшенный размер
- Frame.Position = UDim2.new(0.1, 0, 0.1, 0) -- Центрирование
- DrawingArea.Parent = Frame
- DrawingArea.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- DrawingArea.Size = UDim2.new(1, 0, 1, 0)
- local drawing = false
- local lastPosition = nil
- local function startDrawing(input)
- drawing = true
- lastPosition = input.Position
- end
- local function stopDrawing()
- drawing = false
- lastPosition = nil
- end
- local function draw(input)
- if drawing and lastPosition then
- local currentPosition = input.Position
- local line = Instance.new("Frame")
- line.Parent = DrawingArea
- line.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- line.BorderSizePixel = 0
- line.Size = UDim2.new(0, (currentPosition - lastPosition).magnitude, 0, 4) -- Толщина линии увеличена
- line.Position = UDim2.new(0, lastPosition.X, 0, lastPosition.Y)
- line.Rotation = math.deg(math.atan2(currentPosition.Y - lastPosition.Y, currentPosition.X - lastPosition.X))
- lastPosition = currentPosition
- end
- end
- DrawingArea.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- startDrawing(input)
- end
- end)
- DrawingArea.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- stopDrawing()
- end
- end)
- DrawingArea.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- draw(input)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement