Advertisement
1zxyuuki

Untitled

Feb 21st, 2024 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. -- Definição da tela
  2. local YukiWare = Instance.new("ScreenGui")
  3. YukiWare.Name = "YukiWare"
  4. YukiWare.Parent = game.CoreGui
  5. YukiWare.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  6.  
  7. -- Definição do botão
  8. local Main = Instance.new("Frame")
  9. Main.Name = "Main"
  10. Main.Parent = YukiWare
  11. Main.ClipsDescendants = false
  12. Main.AnchorPoint = Vector2.new(0.5, 0.5)
  13. Main.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  14. Main.Position = UDim2.new(0.1, 40, 0.1, -52)
  15. Main.Size = UDim2.new(0, 32, 0, 32)
  16. Main.Transparency = 1
  17.  
  18. local Corner = Instance.new("UICorner")
  19. Corner.Name = "Corner"
  20. Corner.Parent = Main
  21. CornerRadius = 0,4
  22.  
  23. local Button = Instance.new("TextButton")
  24. Button.Name = "Button"
  25. Button.Parent = Main
  26. Button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  27. Button.Position = UDim2.new(0, 0, 0, 0)
  28. Button.Size = UDim2.new(1, 0, 1, 0)
  29. Button.Font = Enum.Font.SourceSans
  30. Button.Text = "YW"
  31. Button.TextColor3 = Color3.fromRGB(255, 255, 255)
  32. Button.TextSize = 19
  33. Button.Transparency = 0.4
  34. Button.TextTransparency = 0
  35.  
  36. local ButtonCorner = Instance.new("UICorner")
  37. Corner.Name = "Corner"
  38. Corner.Parent = Button
  39. CornerRadius = 0,4
  40.  
  41. -- Variáveis para controle de arrastar
  42. local dragging
  43. local dragStart
  44. local startPos
  45.  
  46. -- Função para iniciar o arrastar
  47. local function startDrag(input)
  48. dragging = true
  49. startPos = Main.Position
  50. dragStart = input.Position
  51. input.Changed:Connect(function()
  52. if input.UserInputState == Enum.UserInputState.End then
  53. dragging = false
  54. end
  55. end)
  56. end
  57.  
  58. -- Função para atualizar a posição durante o arrastar
  59. local function updateDrag(input)
  60. if dragging then
  61. local delta = input.Position - dragStart
  62. Main.Position = UDim2.new(
  63. startPos.X.Scale,
  64. startPos.X.Offset + delta.X,
  65. startPos.Y.Scale,
  66. startPos.Y.Offset + delta.Y
  67. )
  68. end
  69. end
  70.  
  71. -- Conectar eventos de mouse para arrastar o botão
  72. Button.InputBegan:Connect(function(input)
  73. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  74. startDrag(input)
  75. end
  76. end)
  77.  
  78. Button.InputChanged:Connect(function(input)
  79. if input.UserInputType == Enum.UserInputType.MouseMovement then
  80. updateDrag(input)
  81. end
  82. end)
  83.  
  84. Button.InputEnded:Connect(function(input)
  85. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  86. dragging = false
  87. end
  88. end)
  89.  
  90. -- Função para enviar o evento de tecla ao pressionar o botão
  91. Button.MouseButton1Click:Connect(function()
  92. game:GetService("VirtualInputManager"):SendKeyEvent(true, "LeftControl", false, game)
  93. end)
  94.  
  95. -- Animação de deslizamento do botão
  96. Button.MouseEnter:Connect(function()
  97. Button.Size = UDim2.new(1.1, 0, 1.1, 0)
  98. Button.Position = UDim2.new(-0.05, 0, 0, 0)
  99. end)
  100.  
  101. Button.MouseLeave:Connect(function()
  102. Button.Size = UDim2.new(1, 0, 1, 0)
  103. Button.Position = UDim2.new(0, 0, 0, 0)
  104. end)
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement