Advertisement
CriShoux

Destroy GUI

Sep 7th, 2018
3,329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. local equipped = false
  2. local Mouse = game.Players.LocalPlayer:GetMouse()
  3.  
  4. local box = Instance.new("SelectionBox", game.StarterGui)
  5. box.Adornee = nil
  6. box.Color3 = Color3.fromRGB(255, 255, 255)
  7. box.SurfaceColor3 = Color3.fromRGB(255, 255, 255)
  8. box.LineThickness = 0.1
  9.  
  10. -- Instances:
  11.  
  12. local DestroyUI = Instance.new("ScreenGui")
  13. local Main = Instance.new("TextButton")
  14. local Check = Instance.new("BoolValue")
  15. local UITextSizeConstraint = Instance.new("UITextSizeConstraint")
  16. local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
  17.  
  18. --Properties:
  19.  
  20. DestroyUI.Name = "DestroyUI"
  21. DestroyUI.Parent = game.CoreGui
  22.  
  23. Main.Name = "Main"
  24. Main.Parent = DestroyUI
  25. Main.AnchorPoint = Vector2.new(1, 0)
  26. Main.BackgroundColor3 = Color3.fromRGB(255,255,255)
  27. Main.BorderSizePixel = 0
  28. Main.Position = UDim2.new(1, 0, 0, 0)
  29. Main.Size = UDim2.new(0.150000006, 0, 0.0500000007, 0)
  30. Main.AutoButtonColor = false
  31. Main.Font = Enum.Font.SourceSansLight
  32. Main.Text = "Destroy"
  33. Main.TextColor3 = Color3.fromRGB(255, 0, 0)
  34. Main.TextScaled = true
  35. Main.TextSize = 14
  36. Main.TextWrapped = true
  37.  
  38. Check.Parent = DestroyUI
  39. Check.Value = false
  40.  
  41. UITextSizeConstraint.Parent = Main
  42. UITextSizeConstraint.MaxTextSize = 40
  43.  
  44. UIAspectRatioConstraint.Parent = Main
  45. UIAspectRatioConstraint.AspectRatio = 3.9268293380737
  46.  
  47. -- Scripts
  48.  
  49. local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
  50.  
  51. local tweenToGreen = {TextColor3 = Color3.fromRGB(0, 255, 127)}
  52. local tweenToRed = {TextColor3 = Color3.fromRGB(255, 0, 0)}
  53.  
  54. local AnimationGreen = game:GetService("TweenService"):Create(Main, tweenInfo, tweenToGreen)
  55. local AnimationRed = game:GetService("TweenService"):Create(Main, tweenInfo, tweenToRed)
  56.  
  57. Main.MouseButton1Down:Connect(function()
  58. if Check.Value == false then
  59. Check.Value = true
  60. AnimationGreen:Play()
  61. equipped = true
  62. box.Parent = game.Workspace
  63. while equipped == true do
  64. wait(0.1)
  65. box.Adornee = Mouse.Target
  66. end
  67. else
  68. Check.Value = false
  69. AnimationRed:Play()
  70. equipped = false
  71. box.Adornee = nil
  72. box.Parent = game.StarterGui
  73. end
  74. end)
  75.  
  76. Mouse.Button1Down:Connect(function()
  77. if equipped == true then
  78. Mouse.Target:Destroy()
  79. end
  80. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement