tomoneko

console

Apr 9th, 2025 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. -- GUI作成
  2. local ScreenGui = Instance.new("ScreenGui")
  3. local ConsoleFrame = Instance.new("Frame")
  4. local TabFrame = Instance.new("Frame")
  5. local MinimizeButton = Instance.new("TextButton")
  6. local CloseButton = Instance.new("TextButton")
  7. local MessageContainer = Instance.new("ScrollingFrame")
  8. local UIListLayout = Instance.new("UIListLayout")
  9.  
  10. -- GUIプロパティの設定
  11. ScreenGui.Name = "CustomConsole"
  12. ScreenGui.ResetOnSpawn = false
  13.  
  14. ConsoleFrame.Name = "ConsoleFrame"
  15. ConsoleFrame.Size = UDim2.new(0, 400, 0, 300)
  16. ConsoleFrame.Position = UDim2.new(0.5, -200, 0.5, -150)
  17. ConsoleFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  18. ConsoleFrame.BorderSizePixel = 0
  19. ConsoleFrame.Active = true
  20. ConsoleFrame.Draggable = false -- ドラッグはスクリプトで制御
  21.  
  22. TabFrame.Name = "TabFrame"
  23. TabFrame.Size = UDim2.new(1, 0, 0, 30)
  24. TabFrame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  25. TabFrame.BorderSizePixel = 0
  26.  
  27. MinimizeButton.Name = "MinimizeButton"
  28. MinimizeButton.Size = UDim2.new(0, 50, 1, 0)
  29. MinimizeButton.Position = UDim2.new(1, -100, 0, 0)
  30. MinimizeButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  31. MinimizeButton.Text = "_"
  32.  
  33. CloseButton.Name = "CloseButton"
  34. CloseButton.Size = UDim2.new(0, 50, 1, 0)
  35. CloseButton.Position = UDim2.new(1, -50, 0, 0)
  36. CloseButton.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  37. CloseButton.Text = "X"
  38.  
  39. MessageContainer.Name = "MessageContainer"
  40. MessageContainer.Size = UDim2.new(1, 0, 1, -30)
  41. MessageContainer.Position = UDim2.new(0, 0, 0, 30)
  42. MessageContainer.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  43. MessageContainer.BorderSizePixel = 0
  44. MessageContainer.CanvasSize = UDim2.new(0, 0, 0, 0)
  45. MessageContainer.ScrollBarThickness = 8
  46.  
  47. UIListLayout.Padding = UDim.new(0, 5)
  48. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  49.  
  50. -- メッセージ管理
  51. local messages = {}
  52.  
  53. local function addMessage(message, messageType)
  54. for _, msg in pairs(messages) do
  55. if msg.text == message then
  56. msg.count = msg.count + 1
  57. msg.label.Text = message .. " × " .. msg.count
  58. return
  59. end
  60. end
  61.  
  62. local newMessage = {
  63. text = message,
  64. count = 1,
  65. label = Instance.new("TextLabel")
  66. }
  67. newMessage.label.Text = message
  68. newMessage.label.Parent = MessageContainer
  69. table.insert(messages, newMessage)
  70. end
  71.  
  72. -- メッセージの種類フィルタリング
  73. local function filterMessages(filterType)
  74. for _, msg in pairs(messages) do
  75. msg.label.Visible = (msg.type == filterType or filterType == "All")
  76. end
  77. end
  78.  
  79. -- GUIの移動可能設定
  80. local dragging, dragStart, startPos
  81. ConsoleFrame.InputBegan:Connect(function(input)
  82. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  83. dragging = true
  84. dragStart = input.Position
  85. startPos = ConsoleFrame.Position
  86. end
  87. end)
  88.  
  89. ConsoleFrame.InputChanged:Connect(function(input)
  90. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  91. local delta = input.Position - dragStart
  92. ConsoleFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  93. end
  94. end)
  95.  
  96. ConsoleFrame.InputEnded:Connect(function(input)
  97. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  98. dragging = false
  99. end
  100. end)
  101.  
  102. -- タブ機能
  103. MinimizeButton.MouseButton1Click:Connect(function()
  104. MessageContainer.Visible = not MessageContainer.Visible
  105. end)
  106.  
  107. CloseButton.MouseButton1Click:Connect(function()
  108. ScreenGui:Destroy()
  109. end)
  110.  
  111. -- メッセージ出力のフック
  112. local originalPrint = print
  113. print = function(...)
  114. local args = {...}
  115. local message = table.concat(args, " ")
  116. addMessage(message, "Message")
  117. originalPrint(message)
  118. end
  119.  
  120. -- GUIの親設定
  121. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  122. ConsoleFrame.Parent = ScreenGui
  123. TabFrame.Parent = ConsoleFrame
  124. MinimizeButton.Parent = TabFrame
  125. CloseButton.Parent = TabFrame
  126. MessageContainer.Parent = ConsoleFrame
  127. UIListLayout.Parent = MessageContainer
  128.  
Advertisement
Add Comment
Please, Sign In to add comment